Formatting Cleanup

This commit is contained in:
Kam committed 2026-03-11 05:05:39 -04:00
1 parent 66e2066fcc
commit 40b07df4a5
31 files changed
+7646 -3493

No files matched your search

@@ -1,6 +1,5 @@
package com.goodbird.npcgecko.network;
import com.goodbird.npcgecko.entity.EntityCustomModel;
import com.goodbird.npcgecko.tile.TileEntityCustomModel;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
@@ -8,15 +7,10 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.Server;
import noppes.npcs.blocks.tiles.TileScripted;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface;
import software.bernie.geckolib3.core.builder.AnimationBuilder;
import software.bernie.geckolib3.core.builder.ILoopType;
import software.bernie.geckolib3.core.builder.RawAnimation;
@@ -26,9 +20,11 @@ import java.io.IOException;
public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPacketSyncTileManualAnim, IMessage> {
public AnimationBuilder builder;
public int x, y, z;
public CPacketSyncTileManualAnim(){
public CPacketSyncTileManualAnim() {
}
public CPacketSyncTileManualAnim(TileEntity tile, AnimationBuilder builder) {
this.builder = builder;
this.x = tile.xCoord;
@@ -40,7 +36,8 @@ public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPac
public void toBytes(ByteBuf buf) {
try {
writeAnimBuilder(buf, builder);
}catch (Exception ignored){ }
} catch (Exception ignored) {
}
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
@@ -50,7 +47,8 @@ public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPac
public void fromBytes(ByteBuf buf) {
try {
builder = readAnimBuilder(buf);
}catch (Exception ignored){ }
} catch (Exception ignored) {
}
x = buf.readInt();
y = buf.readInt();
z = buf.readInt();
@@ -60,25 +58,25 @@ public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPac
public static void writeAnimBuilder(ByteBuf buffer, AnimationBuilder builder) throws IOException {
NBTTagCompound compound = new NBTTagCompound();
NBTTagList animList = new NBTTagList();
for(RawAnimation anim: builder.getRawAnimationList()){
for (RawAnimation anim : builder.getRawAnimationList()) {
NBTTagCompound animTag = new NBTTagCompound();
animTag.setString("name", anim.animationName);
if(anim.loopType!=null) {
if (anim.loopType != null) {
animTag.setInteger("loop", ((ILoopType.EDefaultLoopTypes) anim.loopType).ordinal());
}else{
animTag.setInteger("loop",1);
} else {
animTag.setInteger("loop", 1);
}
animList.appendTag(animTag);
}
compound.setTag("anims",animList);
ByteBufUtils.writeNBT(buffer,compound);
compound.setTag("anims", animList);
ByteBufUtils.writeNBT(buffer, compound);
}
public static AnimationBuilder readAnimBuilder(ByteBuf buffer) throws IOException {
AnimationBuilder builder = new AnimationBuilder();
NBTTagCompound compound = ByteBufUtils.readNBT(buffer);
NBTTagList animList = compound.getTagList("anims",10);
for(int i=0;i<animList.tagCount();i++){
NBTTagList animList = compound.getTagList("anims", 10);
for (int i = 0; i < animList.tagCount(); i++) {
NBTTagCompound animTag = animList.getCompoundTagAt(i);
builder.addAnimation(animTag.getString("name"),
ILoopType.EDefaultLoopTypes.values()[animTag.getInteger("loop")]);
@@ -89,9 +87,9 @@ public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPac
@Override
public IMessage onMessage(CPacketSyncTileManualAnim message, MessageContext ctx) {
TileEntity entity = Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z);
if(!(entity instanceof TileScripted)) return null;
if (!(entity instanceof TileScripted)) return null;
TileScripted tile = (TileScripted) entity;
if(tile.renderTile==null){
if (tile.renderTile == null) {
tile.renderTile = new TileEntityCustomModel();
}
TileEntityCustomModel geckoTile = (TileEntityCustomModel) tile.renderTile;