mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
C4 now uses a finished ExVNT, chemmfac slot shenanigans
This commit is contained in:
parent
70299728da
commit
58d3178650
@ -1,5 +1,6 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.explosion.vanillant.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@ -16,6 +17,7 @@ public class BlockChargeC4 extends BlockChargeBase {
|
||||
safe = false;
|
||||
|
||||
ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 10F).makeStandard();
|
||||
xnt.setBlockAllocator(new BlockAllocatorStandard(64));
|
||||
xnt.explode();
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
|
||||
@ -26,6 +26,6 @@ public class BlockChargeSemtex extends BlockChargeBase {
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockChargeDynamite.renderID;
|
||||
return BlockChargeC4.renderID;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.packet.ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ExplosionEffectStandard implements IExplosionSFX {
|
||||
|
||||
@Override
|
||||
public void doEffect(ExplosionVNT explosion, World world, double x, double y, double z, float size) {
|
||||
|
||||
if(world.isRemote)
|
||||
return;
|
||||
|
||||
world.playSoundEffect(x, y, z, "random.explode", 4.0F, (1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket(x, y, z, explosion.size, explosion.compat.affectedBlockPositions), new TargetPoint(world.provider.dimensionId, x, y, z, 250));
|
||||
}
|
||||
|
||||
public static void performClient(World world, double x, double y, double z, float size, List affectedBlocks) {
|
||||
|
||||
if(size >= 2.0F) {
|
||||
world.spawnParticle("hugeexplosion", x, y, z, 1.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
world.spawnParticle("largeexplode", x, z, z, 1.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
int count = affectedBlocks.size();
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
|
||||
ChunkPosition pos = (ChunkPosition) affectedBlocks.get(i);
|
||||
int pX = pos.chunkPosX;
|
||||
int pY = pos.chunkPosY;
|
||||
int pZ = pos.chunkPosZ;
|
||||
|
||||
double oX = (double) ((float) pX + world.rand.nextFloat());
|
||||
double oY = (double) ((float) pY + world.rand.nextFloat());
|
||||
double oZ = (double) ((float) pZ + world.rand.nextFloat());
|
||||
double dX = oX - x;
|
||||
double dY = oY - y;
|
||||
double dZ = oZ - z;
|
||||
double delta = (double) MathHelper.sqrt_double(dX * dX + dY * dY + dZ * dZ) / 1D /* hehehe */;
|
||||
dX /= delta;
|
||||
dY /= delta;
|
||||
dZ /= delta;
|
||||
double mod = 0.5D / (delta / (double) size + 0.1D);
|
||||
mod *= (double) (world.rand.nextFloat() * world.rand.nextFloat() + 0.3F);
|
||||
dX *= mod;
|
||||
dY *= mod;
|
||||
dZ *= mod;
|
||||
world.spawnParticle("explode", (oX + x * 1.0D) / 2.0D, (oY + y * 1.0D) / 2.0D, (oZ + z * 1.0D) / 2.0D, dX, dY, dZ);
|
||||
world.spawnParticle("smoke", oX, oY, oZ, dX, dY, dZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.hbm.explosion.vanillant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -31,8 +32,9 @@ public class ExplosionVNT {
|
||||
protected double posZ;
|
||||
protected float size;
|
||||
public Entity exploder;
|
||||
|
||||
public Explosion compat; //TODO: override and implement getters for the EVNT's data
|
||||
|
||||
private Map compatPlayers = new HashMap();
|
||||
public Explosion compat;
|
||||
|
||||
public ExplosionVNT(World world, double x, double y, double z, float size) {
|
||||
this(world, x, y, z, size, null);
|
||||
@ -46,10 +48,19 @@ public class ExplosionVNT {
|
||||
this.size = size;
|
||||
this.exploder = exploder;
|
||||
|
||||
this.compat = new Explosion(world, exploder, x, y, z, size);
|
||||
this.compat = new Explosion(world, exploder, x, y, z, size) {
|
||||
|
||||
@Override
|
||||
public Map func_77277_b() {
|
||||
return ExplosionVNT.this.compatPlayers;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void explode() {
|
||||
|
||||
this.compat.exploder = this.exploder;
|
||||
this.compat.explosionSize = this.size;
|
||||
|
||||
boolean processBlocks = blockAllocator != null && blockProcessor != null;
|
||||
boolean processEntities = entityProcessor != null && playerProcessor != null;
|
||||
@ -57,12 +68,18 @@ public class ExplosionVNT {
|
||||
HashSet<ChunkPosition> affectedBlocks = null;
|
||||
HashMap<EntityPlayer, Vec3> affectedPlayers = null;
|
||||
|
||||
//allocation
|
||||
if(processBlocks) affectedBlocks = blockAllocator.allocate(this, world, posX, posY, posZ, size);
|
||||
if(processEntities) affectedPlayers = entityProcessor.process(this, world, posX, posY, posZ, size);
|
||||
|
||||
//serverside processing
|
||||
if(processBlocks) blockProcessor.process(this, world, posX, posY, posZ, affectedBlocks);
|
||||
if(processEntities) playerProcessor.process(this, world, posX, posY, posZ, affectedPlayers);
|
||||
|
||||
//compat
|
||||
if(processBlocks) this.compat.affectedBlockPositions.addAll(affectedBlocks);
|
||||
if(processEntities) this.compatPlayers.putAll(affectedPlayers);
|
||||
|
||||
if(sfx != null) {
|
||||
for(IExplosionSFX fx : sfx) {
|
||||
fx.doEffect(this, world, posX, posY, posZ, size);
|
||||
@ -96,6 +113,7 @@ public class ExplosionVNT {
|
||||
this.setBlockProcessor(new BlockProcessorStandard());
|
||||
this.setEntityProcessor(new EntityProcessorStandard());
|
||||
this.setPlayerProcessor(new PlayerProcessorStandard());
|
||||
this.setSFX(new ExplosionEffectStandard());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotUpgrade;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemfac;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -15,14 +16,41 @@ public class ContainerChemfac extends Container {
|
||||
public ContainerChemfac(InventoryPlayer playerInv, TileEntityMachineChemfac tile) {
|
||||
chemfac = tile;
|
||||
|
||||
this.addSlotToContainer(new Slot(tile, 0, 234, 79));
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
for(int j = 0; j < 2; j++) {
|
||||
this.addSlotToContainer(new SlotUpgrade(tile, 1 + i * 2 + j, 217 + j * 18, 172 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
for(int j = 0; j < 2; j++) {
|
||||
|
||||
for(int k = 0; k < 2; k++) {
|
||||
for(int l = 0; l < 2; l++) {
|
||||
this.addSlotToContainer(new Slot(tile, this.inventorySlots.size(), 7 + j * 110 + l * 16, 14 + i * 38 + k * 16));
|
||||
}
|
||||
}
|
||||
|
||||
for(int k = 0; k < 2; k++) {
|
||||
for(int l = 0; l < 2; l++) {
|
||||
this.addSlotToContainer(new Slot(tile, this.inventorySlots.size(), 69 + j * 110 + l * 16, 14 + i * 38 + k * 16));
|
||||
}
|
||||
}
|
||||
|
||||
this.addSlotToContainer(new Slot(tile, this.inventorySlots.size(), 51 + j * 110, 30 + i * 38));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 122 + i * 18));
|
||||
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 34 + j * 18, 174 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 180));
|
||||
this.addSlotToContainer(new Slot(playerInv, i, 34 + i * 18, 232));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemfac;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIChemfac extends GuiInfoContainer {
|
||||
@ -30,18 +30,20 @@ public class GUIChemfac extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
|
||||
String name = this.chemfac.hasCustomInventoryName() ? this.chemfac.getInventoryName() : I18n.format(this.chemfac.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 0xC7C1A3);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) { }
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, 211);
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 211, 26, 211, 176, 45);
|
||||
|
||||
for(int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
|
||||
Slot s = this.inventorySlots.getSlot(i);
|
||||
|
||||
this.fontRendererObj.drawStringWithShadow(i + "", guiLeft + s.xDisplayPosition + 2, guiTop + s.yDisplayPosition, 0xffffff);
|
||||
this.fontRendererObj.drawStringWithShadow(s.getSlotIndex() + "", guiLeft + s.xDisplayPosition + 2, guiTop + s.yDisplayPosition + 8, 0xff8080);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,10 +10,13 @@ import com.hbm.interfaces.IBomb.BombReturnCode;
|
||||
import com.hbm.interfaces.IHoldableWeapon;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.PlayerInformPacket;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
import com.hbm.util.ChatBuilder;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@ -44,19 +47,11 @@ public class ItemLaserDetonator extends Item implements IHoldableWeapon {
|
||||
MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
|
||||
|
||||
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||
|
||||
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
|
||||
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("] ").color(EnumChatFormatting.DARK_AQUA)
|
||||
.nextTranslation(ret.getUnlocalizedMessage()).color(ret.wasSuccessful() ? EnumChatFormatting.YELLOW : EnumChatFormatting.RED).flush());
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(ret.getUnlocalizedMessage()).color(ret.wasSuccessful() ? EnumChatFormatting.YELLOW : EnumChatFormatting.RED).flush()), (EntityPlayerMP) player);
|
||||
|
||||
} else {
|
||||
world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F);
|
||||
|
||||
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
|
||||
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
|
||||
.next("] ").color(EnumChatFormatting.DARK_AQUA)
|
||||
.nextTranslation(BombReturnCode.ERROR_NO_BOMB.getUnlocalizedMessage()).color(EnumChatFormatting.RED).flush());
|
||||
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(BombReturnCode.ERROR_NO_BOMB.getUnlocalizedMessage()).color(EnumChatFormatting.RED).flush()), (EntityPlayerMP) player);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ import com.hbm.entity.mob.botprime.*;
|
||||
import com.hbm.entity.mob.siege.*;
|
||||
import com.hbm.entity.particle.*;
|
||||
import com.hbm.entity.projectile.*;
|
||||
import com.hbm.explosion.vanillant.ExplosionEffectStandard;
|
||||
import com.hbm.handler.HbmKeybinds;
|
||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||
import com.hbm.items.ModItems;
|
||||
@ -779,6 +780,8 @@ public class ClientProxy extends ServerProxy {
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
|
||||
System.out.println("FUCK YOU");
|
||||
|
||||
if(world == null) //might i ask why?
|
||||
return;
|
||||
|
||||
|
||||
@ -60,9 +60,10 @@ public class AuxParticlePacketNT implements IMessage {
|
||||
|
||||
if(Minecraft.getMinecraft().theWorld == null)
|
||||
return null;
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
NBTTagCompound nbt = m.buffer.readNBTTagCompoundFromBuffer();
|
||||
|
||||
if(nbt != null)
|
||||
|
||||
@ -20,8 +20,8 @@ public class ExplosionKnockbackPacket implements IMessage {
|
||||
|
||||
public ExplosionKnockbackPacket(Vec3 vec) {
|
||||
this.motionX = (float) vec.xCoord;
|
||||
this.motionY = (float) vec.xCoord;
|
||||
this.motionZ = (float) vec.xCoord;
|
||||
this.motionY = (float) vec.yCoord;
|
||||
this.motionZ = (float) vec.zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,94 @@
|
||||
package com.hbm.packet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionEffectStandard;
|
||||
|
||||
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 net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
|
||||
/**
|
||||
* Can you tell I'm fucking done with packets? Well, can you?
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
public class ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket implements IMessage {
|
||||
|
||||
private double posX;
|
||||
private double posY;
|
||||
private double posZ;
|
||||
private float size;
|
||||
private List affectedBlocks;
|
||||
|
||||
public ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket() { }
|
||||
|
||||
public ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket(double x, double y, double z, float size, List blocks) {
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
this.size = size;
|
||||
this.affectedBlocks = new ArrayList(blocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.posX = (double) buf.readFloat();
|
||||
this.posY = (double) buf.readFloat();
|
||||
this.posZ = (double) buf.readFloat();
|
||||
this.size = buf.readFloat();
|
||||
int i = buf.readInt();
|
||||
this.affectedBlocks = new ArrayList(i);
|
||||
int j = (int) this.posX;
|
||||
int k = (int) this.posY;
|
||||
int l = (int) this.posZ;
|
||||
|
||||
for(int i1 = 0; i1 < i; ++i1) {
|
||||
int j1 = buf.readByte() + j;
|
||||
int k1 = buf.readByte() + k;
|
||||
int l1 = buf.readByte() + l;
|
||||
this.affectedBlocks.add(new ChunkPosition(j1, k1, l1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeFloat((float) this.posX);
|
||||
buf.writeFloat((float) this.posY);
|
||||
buf.writeFloat((float) this.posZ);
|
||||
buf.writeFloat(this.size);
|
||||
buf.writeInt(this.affectedBlocks.size());
|
||||
int i = (int) this.posX;
|
||||
int j = (int) this.posY;
|
||||
int k = (int) this.posZ;
|
||||
Iterator iterator = this.affectedBlocks.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) iterator.next();
|
||||
int l = chunkposition.chunkPosX - i;
|
||||
int i1 = chunkposition.chunkPosY - j;
|
||||
int j1 = chunkposition.chunkPosZ - k;
|
||||
buf.writeByte(l);
|
||||
buf.writeByte(i1);
|
||||
buf.writeByte(j1);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket, IMessage> {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IMessage onMessage(ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket m, MessageContext ctx) {
|
||||
|
||||
ExplosionEffectStandard.performClient(Minecraft.getMinecraft().theWorld, m.posX, m.posY, m.posZ, m.size, m.affectedBlocks);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,6 @@ package com.hbm.packet;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.TileEntityTickingBase;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
|
||||
@ -95,8 +95,10 @@ public class PacketDispatcher {
|
||||
wrapper.registerMessage(AnvilCraftPacket.Handler.class, AnvilCraftPacket.class, i++, Side.SERVER);
|
||||
//Sends a funi text to display like a music disc announcement
|
||||
wrapper.registerMessage(TEDoorAnimationPacket.Handler.class, TEDoorAnimationPacket.class, i++, Side.CLIENT);
|
||||
//Sends a funi text to display like a music disc announcement
|
||||
//Does ExVNT standard player knockback
|
||||
wrapper.registerMessage(ExplosionKnockbackPacket.Handler.class, ExplosionKnockbackPacket.class, i++, Side.CLIENT);
|
||||
//just go fuck yourself already
|
||||
wrapper.registerMessage(ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket.Handler.class, ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket.class, i++, Side.CLIENT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,25 +9,45 @@ 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 net.minecraft.util.IChatComponent;
|
||||
|
||||
public class PlayerInformPacket implements IMessage {
|
||||
|
||||
String dmesg = "";
|
||||
boolean fancy;
|
||||
private String dmesg = "";
|
||||
private IChatComponent component;
|
||||
|
||||
public PlayerInformPacket() { }
|
||||
|
||||
public PlayerInformPacket(String dmesg) {
|
||||
this.fancy = false;
|
||||
this.dmesg = dmesg;
|
||||
}
|
||||
|
||||
public PlayerInformPacket(IChatComponent component) {
|
||||
this.fancy = true;
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
dmesg = ByteBufUtils.readUTF8String(buf);
|
||||
fancy = buf.readBoolean();
|
||||
|
||||
if(!fancy) {
|
||||
dmesg = ByteBufUtils.readUTF8String(buf);
|
||||
} else {
|
||||
component = IChatComponent.Serializer.func_150699_a(ByteBufUtils.readUTF8String(buf));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
ByteBufUtils.writeUTF8String(buf, dmesg);
|
||||
buf.writeBoolean(fancy);
|
||||
if(!fancy) {
|
||||
ByteBufUtils.writeUTF8String(buf, dmesg);
|
||||
} else {
|
||||
ByteBufUtils.writeUTF8String(buf, IChatComponent.Serializer.func_150696_a(component));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<PlayerInformPacket, IMessage> {
|
||||
@ -36,7 +56,8 @@ public class PlayerInformPacket implements IMessage {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IMessage onMessage(PlayerInformPacket m, MessageContext ctx) {
|
||||
try {
|
||||
MainRegistry.proxy.displayTooltip(m.dmesg);
|
||||
|
||||
MainRegistry.proxy.displayTooltip(m.fancy ? m.component.getFormattedText() : m.dmesg);
|
||||
|
||||
} catch (Exception x) { }
|
||||
return null;
|
||||
|
||||
@ -46,22 +46,22 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
|
||||
@Override
|
||||
public int getRecipeCount() {
|
||||
return 0;
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTankCapacity() {
|
||||
return 0;
|
||||
return 32_000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTemplateIndex(int index) {
|
||||
return 0;
|
||||
return 13 + index * 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotIndicesFromIndex(int index) {
|
||||
return new int[] {4, 4, 4, 4}; //yeah whatever
|
||||
return new int[] {5 + index * 9, 8 + index * 9, 9 + index * 9, 12 + index * 9};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user