mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 21:20:06 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
83698cb73c
commit
84c2239244
561 files changed
+8872
-9300
No files matched your search
@@ -1,14 +1,16 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.ArmorProxyCommon;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class AccessoryInventoryPacket extends AbstractPacket {
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
|
||||
/**
|
||||
* This Packet is for sending the players TPlayerStats from the server to the client.
|
||||
@@ -15,11 +17,14 @@ import tconstruct.armor.player.TPlayerStats;
|
||||
* @author covers1624
|
||||
*/
|
||||
public class ArmourGuiSyncPacket extends AbstractPacket {
|
||||
|
||||
NBTTagCompound playerStats = new NBTTagCompound();
|
||||
|
||||
public ArmourGuiSyncPacket() {}
|
||||
|
||||
/**
|
||||
* For sending the players TPlayerStats to the client.
|
||||
*
|
||||
* @param tag, The players TPlayerStats written to NBT.
|
||||
*/
|
||||
public ArmourGuiSyncPacket(NBTTagCompound tag) {
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import tconstruct.armor.PlayerAbilityHelper;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class BeltPacket extends AbstractPacket {
|
||||
|
||||
public BeltPacket() {}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class DoubleJumpPacket extends AbstractPacket {
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import tconstruct.armor.PlayerAbilityHelper;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import tconstruct.armor.PlayerAbilityHelper;
|
||||
|
||||
public class GogglePacket extends AbstractPacket {
|
||||
|
||||
boolean active;
|
||||
|
||||
public GogglePacket() {}
|
||||
@@ -31,7 +34,8 @@ public class GogglePacket extends AbstractPacket {
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
PlayerAbilityHelper.toggleGoggles(player, active);
|
||||
/*TPlayerStats stats = TPlayerStats.get(player);
|
||||
stats.activeGoggles = active;*/
|
||||
/*
|
||||
* TPlayerStats stats = TPlayerStats.get(player); stats.activeGoggles = active;
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class HealthUpdatePacket extends AbstractPacket {
|
||||
|
||||
private float health;
|
||||
|
||||
public HealthUpdatePacket() {}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class MovementUpdatePacket extends AbstractPacket {
|
||||
|
||||
public int entityID;
|
||||
public double x;
|
||||
public double y;
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import mantle.common.network.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.network.*;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.*;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
@@ -7,15 +15,9 @@ import cpw.mods.fml.relauncher.*;
|
||||
import io.netty.buffer.*;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.codec.MessageToMessageCodec;
|
||||
import java.util.*;
|
||||
import mantle.common.network.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.network.*;
|
||||
|
||||
/**
|
||||
* Packet pipeline class. Directs all registered packet data to be handled by
|
||||
* the packets themselves.
|
||||
* Packet pipeline class. Directs all registered packet data to be handled by the packets themselves.
|
||||
*
|
||||
* @author sirgingalot some code from: cpw
|
||||
*/
|
||||
@@ -27,15 +29,12 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
private boolean isPostInitialised = false;
|
||||
|
||||
/**
|
||||
* Register your packet with the pipeline. Discriminators are automatically
|
||||
* set.
|
||||
* Register your packet with the pipeline. Discriminators are automatically set.
|
||||
*
|
||||
* @param clazz
|
||||
* the class to register
|
||||
* @param clazz the class to register
|
||||
*
|
||||
* @return whether registration was successful. Failure may occur if 256
|
||||
* packets have been registered or if the registry already contains
|
||||
* this packet
|
||||
* @return whether registration was successful. Failure may occur if 256 packets have been registered or if the
|
||||
* registry already contains this packet
|
||||
*/
|
||||
public boolean registerPacket(Class<? extends AbstractPacket> clazz) {
|
||||
if (this.packets.size() > 256) {
|
||||
@@ -63,15 +62,15 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
ByteBuf buffer = Unpooled.buffer();
|
||||
Class<? extends AbstractPacket> clazz = msg.getClass();
|
||||
if (!this.packets.contains(msg.getClass())) {
|
||||
throw new NullPointerException(
|
||||
"No Packet Registered for: " + msg.getClass().getCanonicalName());
|
||||
throw new NullPointerException("No Packet Registered for: " + msg.getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
byte discriminator = (byte) this.packets.indexOf(clazz);
|
||||
buffer.writeByte(discriminator);
|
||||
msg.encodeInto(ctx, buffer);
|
||||
FMLProxyPacket proxyPacket = new FMLProxyPacket(
|
||||
buffer.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
|
||||
buffer.copy(),
|
||||
ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
|
||||
out.add(proxyPacket);
|
||||
}
|
||||
|
||||
@@ -96,8 +95,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
break;
|
||||
|
||||
case SERVER:
|
||||
INetHandler netHandler =
|
||||
ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||
player = ((NetHandlerPlayServer) netHandler).playerEntity;
|
||||
pkt.handleServerSide(player);
|
||||
break;
|
||||
@@ -155,16 +153,12 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
/**
|
||||
* Send this message to everyone.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param message The message to send
|
||||
*/
|
||||
public void sendToAll(AbstractPacket message) {
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
@@ -172,87 +166,57 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
/**
|
||||
* Send this message to the specified player.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param player
|
||||
* The player to send it to
|
||||
* @param message The message to send
|
||||
* @param player The player to send it to
|
||||
*/
|
||||
public void sendTo(AbstractPacket message, EntityPlayerMP player) {
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
||||
.set(player);
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to everyone within a certain range of a point.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param point
|
||||
* The
|
||||
* {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint}
|
||||
* around which to send
|
||||
* @param message The message to send
|
||||
* @param point The {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint} around which to send
|
||||
*/
|
||||
public void sendToAllAround(AbstractPacket message, NetworkRegistry.TargetPoint point) {
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
||||
.set(point);
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to everyone within the supplied dimension.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param dimensionId
|
||||
* The dimension id to target
|
||||
* @param message The message to send
|
||||
* @param dimensionId The dimension id to target
|
||||
*/
|
||||
public void sendToDimension(AbstractPacket message, int dimensionId) {
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.DIMENSION);
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
||||
.set(dimensionId);
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to the server.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param message The message to send
|
||||
*/
|
||||
public void sendToServer(AbstractPacket message) {
|
||||
this.channels
|
||||
.get(Side.CLIENT)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.TOSERVER);
|
||||
this.channels.get(Side.CLIENT).writeAndFlush(message);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.crafting.StencilBuilder;
|
||||
import tconstruct.tools.inventory.PatternShaperContainer;
|
||||
import tconstruct.tools.logic.StencilTableLogic;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class PatternTablePacket extends AbstractPacket {
|
||||
|
||||
@@ -62,9 +64,9 @@ public class PatternTablePacket extends AbstractPacket {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (warning)
|
||||
TConstruct.logger.warn("Possible packet-cheating with PatternTable for player "
|
||||
+ player.getCommandSenderName());
|
||||
if (warning) TConstruct.logger.warn(
|
||||
"Possible packet-cheating with PatternTable for player "
|
||||
+ player.getCommandSenderName());
|
||||
else logic.setSelectedPattern(this.contents);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.logic.BattlesignLogic;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.logic.BattlesignLogic;
|
||||
|
||||
public class SignDataPacket extends AbstractPacket {
|
||||
|
||||
private int dimension, x, y, z, length;
|
||||
private String[] text;
|
||||
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import mantle.common.network.PacketUpdateTE;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.smeltery.inventory.SmelteryContainer;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class SmelteryPacket extends AbstractPacket {
|
||||
|
||||
@@ -55,8 +57,7 @@ public class SmelteryPacket extends AbstractPacket {
|
||||
if (player.openContainer instanceof SmelteryContainer) {
|
||||
SmelteryContainer container = (SmelteryContainer) player.openContainer;
|
||||
SmelteryLogic logic = container.logic;
|
||||
if (logic != null
|
||||
&& logic.hasWorldObj()
|
||||
if (logic != null && logic.hasWorldObj()
|
||||
&& logic.getWorldObj().provider.dimensionId == this.dimension
|
||||
&& logic.xCoord == this.x
|
||||
&& logic.yCoord == this.y
|
||||
@@ -75,8 +76,8 @@ public class SmelteryPacket extends AbstractPacket {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
logic.writeToNBT(data);
|
||||
TConstruct.packetPipeline.sendToDimension(
|
||||
new PacketUpdateTE(this.x, this.y, this.z, data), this.dimension);
|
||||
TConstruct.packetPipeline
|
||||
.sendToDimension(new PacketUpdateTE(this.x, this.y, this.z, data), this.dimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import tconstruct.tools.inventory.ToolStationContainer;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import tconstruct.tools.inventory.ToolStationContainer;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
|
||||
public class ToolStationPacket extends AbstractPacket {
|
||||
|
||||
|
||||
Reference in new issue
Block a user