Resolve more client/server sided issues

using Minecraft Development for IntelliJ IDEA plugin.
https://plugins.jetbrains.com/idea/plugin/8327-minecraft-development
This commit is contained in:
mezz committed 2017-02-09 20:13:10 -08:00
1 parent b8acba968e
commit 2423adae4c
98 files changed
+703 -353

No files matched your search

@@ -8,6 +8,8 @@ import binnie.craftgui.core.ITooltip;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.core.renderer.RenderUtil;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlColourDisplay extends Control implements IControlValue<IFlowerColour>, ITooltip {
private IFlowerColour value;
@@ -29,6 +31,7 @@ public class ControlColourDisplay extends Control implements IControlValue<IFlow
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawSolidRect(this.getArea(), -1);
RenderUtil.drawSolidRect(this.getArea().inset(1), -16777216 + this.getValue().getColor(false));
@@ -11,6 +11,8 @@ import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.resource.Texture;
import binnie.craftgui.resource.minecraft.CraftGUITextureSheet;
import binnie.craftgui.resource.minecraft.StandardTexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlColourMixSymbol extends Control implements ITooltip {
static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
@@ -19,6 +21,7 @@ public class ControlColourMixSymbol extends Control implements ITooltip {
int type;
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
if (this.type == 0) {
@@ -38,6 +38,7 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
}
@Override
@SideOnly(Side.CLIENT)
public void registerModel(Item item, IModelManager manager) {
int index = 0;
for (Type type : Type.values()) {
@@ -4,7 +4,10 @@ import binnie.Constants;
import binnie.core.models.ModelManager;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ProxyClient extends Proxy implements IBotanyProxy {
public static ModelManager modelManager = new ModelManager(Constants.BOTANY_MOD_ID);
@@ -25,6 +25,8 @@ import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
@@ -33,6 +35,7 @@ import javax.vecmath.Matrix4f;
import javax.vecmath.Vector3f;
import java.util.EnumMap;
@SideOnly(Side.CLIENT)
public abstract class BaseBakedModel implements IPerspectiveAwareModel {
private final EnumMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap = new EnumMap<>(ItemCameraTransforms.TransformType.class);
private final ResourceLocation particle;
@@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
@@ -30,6 +31,7 @@ public final class BinnieGUIHandler implements IGuiHandler {
@Override
@Nullable
@SideOnly(Side.CLIENT)
public final Object getClientGuiElement(final int id, final EntityPlayer player, final World world, final int x, final int y, final int z) {
if (BinnieCore.getBinnieProxy().isSimulating(world)) {
return this.getServerGuiElement(id, player, world, x, y, z);
@@ -164,6 +164,7 @@ public class Machine implements INetworkedEntity, INbtReadable, INbtWritable, IN
component.onUpdate();
}
} else {
//noinspection MethodCallSideOnly
updateClient();
}
if (this.queuedInventoryUpdate) {
@@ -293,16 +294,24 @@ public class Machine implements INetworkedEntity, INbtReadable, INbtWritable, IN
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound nbt) {
for (final INetwork.RecieveGuiNBT recieve : this.getInterfaces(INetwork.RecieveGuiNBT.class)) {
recieve.recieveGuiNBT(side, player, name, nbt);
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
for (final INetwork.ReceiveGuiNBT receive : this.getInterfaces(INetwork.ReceiveGuiNBT.class)) {
receive.receiveGuiNBTOnServer(player, name, nbt);
}
}
@Override
public void sendGuiNBT(final Map<String, NBTTagCompound> nbt) {
for (final INetwork.SendGuiNBT recieve : this.getInterfaces(INetwork.SendGuiNBT.class)) {
recieve.sendGuiNBT(nbt);
@SideOnly(Side.CLIENT)
public void receiveGuiNBTOnClient(EntityPlayer player, String name, NBTTagCompound nbt) {
for (final INetwork.ReceiveGuiNBT receive : this.getInterfaces(INetwork.ReceiveGuiNBT.class)) {
receive.receiveGuiNBTOnClient(player, name, nbt);
}
}
@Override
public void sendGuiNBTToClient(final Map<String, NBTTagCompound> nbt) {
for (final INetwork.SendGuiNBT send : this.getInterfaces(INetwork.SendGuiNBT.class)) {
send.sendGuiNBTToClient(nbt);
}
}
}
@@ -2,6 +2,8 @@ package binnie.core.machines;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
class ModelBlock extends ModelBase {
private ModelRenderer Block;
@@ -16,6 +18,7 @@ class ModelBlock extends ModelBase {
this.setRotation(this.Block, 0.0f, 0.0f, 0.0f);
}
@SideOnly(Side.CLIENT)
public void render(final float f, final float f1, final float f2, final float f3, final float f4, final float f5) {
super.render(null, f, f1, f2, f3, f4, f5);
this.setRotationAngles(f, f1, f2, f3, f4, f5);
@@ -6,7 +6,6 @@ import binnie.core.machines.network.INetwork;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fml.relauncher.Side;
import java.util.HashMap;
import java.util.Map;
@@ -49,7 +48,12 @@ public class ComponentChargedSlots extends MachineComponent implements INetwork.
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound nbt) {
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
}
@Override
public void receiveGuiNBTOnClient(EntityPlayer player, String name, NBTTagCompound nbt) {
if (name.equals("slot-charges")) {
for (final int i : this.charges.keySet()) {
this.charges.put(i, nbt.getShort("" + i) / 100.0f);
@@ -58,7 +62,7 @@ public class ComponentChargedSlots extends MachineComponent implements INetwork.
}
@Override
public void sendGuiNBT(final Map<String, NBTTagCompound> nbt) {
public void sendGuiNBTToClient(final Map<String, NBTTagCompound> nbt) {
final NBTTagCompound tag = new NBTTagCompound();
for (final int i : this.charges.keySet()) {
tag.setShort("" + i, (short) (this.charges.get(i) * 100.0f));
@@ -3,6 +3,8 @@ package binnie.core.machines.inventory;
import forestry.api.genetics.AlleleManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
@@ -20,6 +22,7 @@ public abstract class SlotValidator extends Validator<ItemStack> {
}
@Nullable
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(final boolean input) {
return (this.sprite == null) ? null : this.sprite.getSprite(input).getSprite();
}
@@ -3,12 +3,13 @@ package binnie.core.machines.network;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Map;
public interface INetwork {
interface SendGuiNBT {
void sendGuiNBT(final Map<String, NBTTagCompound> p0);
void sendGuiNBTToClient(final Map<String, NBTTagCompound> p0);
}
interface TilePacketSync {
@@ -17,10 +18,13 @@ public interface INetwork {
void syncFromNBT(final NBTTagCompound p0);
}
interface RecieveGuiNBT {
void recieveGuiNBT(final Side p0, final EntityPlayer p1, final String p2, final NBTTagCompound p3);
interface ReceiveGuiNBT {
void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt);
@SideOnly(Side.CLIENT)
void receiveGuiNBTOnClient(final EntityPlayer player, final String name, final NBTTagCompound nbt);
}
interface GuiNBT extends RecieveGuiNBT, SendGuiNBT {
interface GuiNBT extends ReceiveGuiNBT, SendGuiNBT {
}
}
@@ -6,7 +6,6 @@ import binnie.core.machines.network.INetwork;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fml.relauncher.Side;
import java.util.HashMap;
import java.util.Map;
@@ -54,7 +53,7 @@ class ComponentCompartmentInventory extends ComponentInventorySlots implements I
}
@Override
public void sendGuiNBT(final Map<String, NBTTagCompound> nbt) {
public void sendGuiNBTToClient(final Map<String, NBTTagCompound> nbt) {
final NBTTagList list = new NBTTagList();
for (int i = 0; i < this.numberOfTabs; ++i) {
final NBTTagCompound nbt2 = new NBTTagCompound();
@@ -67,7 +66,7 @@ class ComponentCompartmentInventory extends ComponentInventorySlots implements I
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound nbt) {
public void receiveGuiNBTOnClient(EntityPlayer player, String name, NBTTagCompound nbt) {
if (name.equals("comp-tabs")) {
final NBTTagList tags = nbt.getTagList("tabs", 10);
for (int i = 0; i < tags.tagCount(); ++i) {
@@ -77,6 +76,10 @@ class ComponentCompartmentInventory extends ComponentInventorySlots implements I
this.tabs.put(tab.getId(), tab);
}
}
}
@Override
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
if (name.equals("comp-change-tab")) {
final CompartmentTab tab2 = new CompartmentTab(0);
tab2.readFromNBT(nbt);
@@ -8,6 +8,8 @@ import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.core.renderer.RenderUtil;
import binnie.craftgui.minecraft.EnumColor;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
class ControlColourSelector extends Control implements ITooltip, IControlValue<EnumColor> {
private EnumColor value;
@@ -35,6 +37,7 @@ class ControlColourSelector extends Control implements ITooltip, IControlValue<E
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
RenderUtil.drawGradientRect(this.getArea(), -16777216 + this.value.getColour(), -16777216 + this.value.getColour());
@@ -79,6 +79,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
}
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
int x = 16;
@@ -279,11 +280,13 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
y2 += 20;
final ControlButton searchButton = new ControlButton(controlCompartment, compartmentWidth - 24 - 64 - 8, compartmentPageHeight, 64, 16, "Search") {
@Override
@SideOnly(Side.CLIENT)
protected void onMouseClick(final EventMouse.Down event) {
WindowCompartment.this.createSearchDialog();
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
final Object texture = this.isMouseOver() ? CraftGUITexture.TabHighlighted : CraftGUITexture.Tab;
CraftGUI.render.texture(CraftGUI.render.getTexture(texture).crop(Position.Bottom, 8), this.getArea());
@@ -293,6 +296,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
searchButton.addHelp("Clicking this will open the Search dialog. This allows you to search the inventory for specific items.");
}
@SideOnly(Side.CLIENT)
public void createSearchDialog() {
new Dialog(this, 252, 192) {
Control slotGrid;
@@ -417,10 +421,10 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
super.recieveGuiNBT(side, player, name, action);
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
super.receiveGuiNBTOnServer(player, name, nbt);
if (name.equals("tab-change")) {
this.currentTab = action.getByte("i");
this.currentTab = nbt.getByte("i");
}
}
@@ -8,11 +8,14 @@ import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.LinkedList;
import java.util.List;
@SideOnly(Side.CLIENT)
public class DoublePassBakedModel implements IBakedModel {
private IBakedModel mainModel;
private int primaryColor = 0xFF000000;
@@ -41,13 +41,14 @@ public enum BinnieCorePacketID implements IPacketID {
final MessageCraftGUI packet3 = new MessageCraftGUI(message);
final EntityPlayer player = BinnieCore.getBinnieProxy().getPlayer();
if (player.openContainer instanceof ContainerCraftGUI && packet3.getTagCompound() != null) {
((ContainerCraftGUI) player.openContainer).recieveNBT(Side.CLIENT, player, packet3.getTagCompound());
//noinspection MethodCallSideOnly
((ContainerCraftGUI) player.openContainer).receiveNBTClient(player, packet3.getTagCompound());
}
} else if (this == BinnieCorePacketID.CraftGUIAction && context.side == Side.SERVER && context.netHandler instanceof NetHandlerPlayServer) {
final MessageCraftGUI packet3 = new MessageCraftGUI(message);
final EntityPlayer player = ((NetHandlerPlayServer) context.netHandler).playerEntity;
if (player.openContainer instanceof ContainerCraftGUI && packet3.getTagCompound() != null) {
((ContainerCraftGUI) player.openContainer).recieveNBT(Side.SERVER, player, packet3.getTagCompound());
((ContainerCraftGUI) player.openContainer).receiveNBTServer(player, packet3.getTagCompound());
}
} else if (this == BinnieCorePacketID.TileDescriptionSync && context.side == Side.CLIENT) {
final MessageTileNBT packet4 = new MessageTileNBT(message);
@@ -1,11 +1,13 @@
package binnie.core.network;
import binnie.Constants;
import binnie.core.AbstractMod;
import binnie.core.network.packet.MessageBinnie;
import com.google.common.base.Preconditions;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.IThreadListener;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
@@ -15,6 +17,10 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
public abstract class BinniePacketHandler implements IMessageHandler<MessageBinnie, IMessage> {
@SuppressWarnings({"unused", "NullableProblems"})
@SidedProxy(modId = Constants.CORE_MOD_ID)
private static MessageProxy messageProxy;
@Nullable
private IPacketProvider provider;
@@ -37,30 +43,38 @@ public abstract class BinniePacketHandler implements IMessageHandler<MessageBinn
final int packetId = message.id;
for (final IPacketID id : this.getProvider().getPacketIDs()) {
if (id.ordinal() == packetId) {
if (ctx.side == Side.CLIENT) {
onClientMessage(id, message, ctx);
} else {
onServerMessage(id, message, ctx);
}
messageProxy.onMessage(id, message, ctx);
return null;
}
}
return null;
}
private static abstract class MessageProxy {
public abstract void onMessage(final IPacketID id, final MessageBinnie message, final MessageContext ctx);
protected static void checkThreadAndEnqueue(final IPacketID id, final MessageBinnie message, final MessageContext ctx, IThreadListener threadListener) {
if (!threadListener.isCallingFromMinecraftThread()) {
threadListener.addScheduledTask(() -> id.onMessage(message, ctx));
}
}
}
@SuppressWarnings("unused")
@SideOnly(Side.CLIENT)
private static void onClientMessage(final IPacketID id, final MessageBinnie message, final MessageContext ctx) {
checkThreadAndEnqueue(id, message, ctx, Minecraft.getMinecraft());
public static class ClientProxy extends MessageProxy {
@Override
public void onMessage(IPacketID id, MessageBinnie message, MessageContext ctx) {
checkThreadAndEnqueue(id, message, ctx, Minecraft.getMinecraft());
}
}
private static void onServerMessage(final IPacketID id, final MessageBinnie message, final MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
checkThreadAndEnqueue(id, message, ctx, player.getServerWorld());
}
private static void checkThreadAndEnqueue(final IPacketID id, final MessageBinnie message, final MessageContext ctx, IThreadListener threadListener) {
if (!threadListener.isCallingFromMinecraftThread()) {
threadListener.addScheduledTask(() -> id.onMessage(message, ctx));
@SuppressWarnings("unused")
public static class ServerProxy extends MessageProxy {
@Override
public void onMessage(IPacketID id, MessageBinnie message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
checkThreadAndEnqueue(id, message, ctx, player.getServerWorld());
}
}
}
@@ -105,6 +105,7 @@ public class WindowFieldKit extends Window {
}
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
this.setTitle("Field Kit");
CraftGUI.render.setStyleSheet(new StyleSheetPunnett());
@@ -265,9 +266,9 @@ public class WindowFieldKit extends Window {
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
super.recieveGuiNBT(side, player, name, action);
if (side == Side.SERVER && name.equals("analyse")) {
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
super.receiveGuiNBTOnServer(player, name, nbt);
if (name.equals("analyse")) {
this.getWindowInventory().setInventorySlotContents(0, Analyser.analyse(this.getWindowInventory().getStackInSlot(0)));
this.getWindowInventory().decrStackSize(1, 1);
}
@@ -196,10 +196,10 @@ public class WindowGenesis extends Window {
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
super.recieveGuiNBT(side, player, name, action);
if (side == Side.SERVER && name.equals("genesis")) {
final ItemStack stack = new ItemStack(action);
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
super.receiveGuiNBTOnServer(player, name, nbt);
if (name.equals("genesis")) {
final ItemStack stack = new ItemStack(nbt);
final InventoryPlayer playerInv = player.inventory;
if (stack.isEmpty()) {
return;
@@ -12,6 +12,8 @@ import binnie.craftgui.events.EventHandler;
import binnie.craftgui.events.EventMouse;
import binnie.craftgui.events.EventValueChanged;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlCheckbox extends Control implements IControlValue<Boolean> {
private boolean value;
@@ -57,6 +59,7 @@ public class ControlCheckbox extends Control implements IControlValue<Boolean> {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
Object texture = this.getValue() ? CraftGUITexture.CheckboxChecked : CraftGUITexture.Checkbox;
if (this.isMouseOver()) {
@@ -7,6 +7,8 @@ import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.core.geometry.TextJustification;
import binnie.craftgui.core.renderer.RenderUtil;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlText extends Control implements IControlValue<String> {
private String text;
@@ -27,6 +29,7 @@ public class ControlText extends Control implements IControlValue<String> {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawText(this.getArea(), this.align, this.text, this.getColour());
}
@@ -17,7 +17,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ControlTextEdit extends Control implements IControlValue<String> {
GuiTextField field;
private GuiTextField field;
private String cachedValue;
public ControlTextEdit(final IWidget parent, final int x, final int y, final int width, final int height) {
@@ -10,6 +10,8 @@ import binnie.craftgui.events.EventButtonClicked;
import binnie.craftgui.events.EventHandler;
import binnie.craftgui.events.EventMouse;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
@@ -56,6 +58,7 @@ public class ControlButton extends Control {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
Object texture = CraftGUITexture.ButtonDisabled;
if (this.isMouseOver()) {
@@ -7,6 +7,8 @@ import binnie.craftgui.core.CraftGUI;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.events.EventMouse;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlOption<T> extends Control implements IControlValue<T> {
private T value;
@@ -51,6 +53,7 @@ public class ControlOption<T> extends Control implements IControlValue<T> {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
if (this.isCurrentSelection()) {
CraftGUI.render.texture(CraftGUITexture.Outline, this.getArea());
@@ -7,6 +7,8 @@ import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.events.EventMouse;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlScrollBar extends Control {
protected final IControlScrollable scrollable;
@@ -67,6 +69,7 @@ public class ControlScrollBar extends Control {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
final IArea renderArea = this.getRenderArea();
Object texture = CraftGUITexture.ScrollDisabled;
@@ -16,6 +16,8 @@ import binnie.craftgui.minecraft.control.ControlItemDisplay;
import binnie.craftgui.minecraft.control.ControlTabIcon;
import binnie.craftgui.resource.Texture;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlTab<T> extends Control implements ITooltip, IControlValue<T> {
private ControlTabBar<T> tabBar;
@@ -68,6 +70,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
Object texture = CraftGUITexture.TabDisabled;
if (this.isMouseOver()) {
@@ -59,6 +59,7 @@ public interface IWidget {
@SideOnly(Side.CLIENT)
void render(int guiWidth, int guiHeight);
@SideOnly(Side.CLIENT)
void updateClient();
void enable();
@@ -299,6 +299,7 @@ public class Widget implements IWidget {
}
@Override
@SideOnly(Side.CLIENT)
public final void updateClient() {
if (!this.isVisible()) {
return;
@@ -29,6 +29,7 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
@@ -185,21 +186,24 @@ public class ContainerCraftGUI extends Container {
return heldItem;
}
public boolean handleNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
if (side == Side.SERVER) {
if (name.equals("tank-click")) {
this.tankClick(player, action.getByte("id"));
}
if (name.equals("slot-reg")) {
final int type = action.getByte("t");
final int index = action.getShort("i");
final int slotNumber = action.getShort("n");
this.createServerSlot(InventoryType.values()[type % 4], index, slotNumber);
for (IContainerListener listener : listeners) {
listener.updateCraftingInventory(this, this.getInventory());
}
public boolean handleNBTServer(final EntityPlayer player, final String name, final NBTTagCompound action) {
if (name.equals("tank-click")) {
this.tankClick(player, action.getByte("id"));
}
if (name.equals("slot-reg")) {
final int type = action.getByte("t");
final int index = action.getShort("i");
final int slotNumber = action.getShort("n");
this.createServerSlot(InventoryType.values()[type % 4], index, slotNumber);
for (IContainerListener listener : listeners) {
listener.updateCraftingInventory(this, this.getInventory());
}
}
return false;
}
@SideOnly(Side.CLIENT)
public boolean handleNBTClient( final EntityPlayer player, final String name, final NBTTagCompound action) {
if (name.contains("tank-update")) {
this.onTankUpdate(action);
} else if (name.equals("power-update")) {
@@ -216,7 +220,6 @@ public class ContainerCraftGUI extends Container {
return false;
}
//TODO: Fix random NullPointerException
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
@@ -244,7 +247,7 @@ public class ContainerCraftGUI extends Container {
}
final INetwork.SendGuiNBT machineSync = Machine.getInterface(INetwork.SendGuiNBT.class, this.window.getInventory());
if (machineSync != null) {
machineSync.sendGuiNBT(this.syncedNBT);
machineSync.sendGuiNBTToClient(this.syncedNBT);
}
final Map<String, NBTTagCompound> sentThisTime = new HashMap<>();
for (final Map.Entry<String, NBTTagCompound> nbt : this.syncedNBT.entrySet()) {
@@ -356,6 +359,7 @@ public class ContainerCraftGUI extends Container {
return slots.toArray(new CustomSlot[0]);
}
@SideOnly(Side.CLIENT)
public void setMouseOverSlot(final Slot slot) {
if (slot.slotNumber != this.mousedOverSlotNumber) {
this.mousedOverSlotNumber = slot.slotNumber;
@@ -387,6 +391,7 @@ public class ContainerCraftGUI extends Container {
this.syncedNBT.put("shift-click-info", nbt);
}
@SideOnly(Side.CLIENT)
private void onRecieveShiftClickHighlights(final EntityPlayer player, final NBTTagCompound data) {
ControlSlot.highlighting.get(EnumHighlighting.ShiftClick).clear();
for (final int slotnumber : data.getIntArray("slots")) {
@@ -407,15 +412,28 @@ public class ContainerCraftGUI extends Container {
return null;
}
public void recieveNBT(final Side side, final EntityPlayer player, final NBTTagCompound action) {
public void receiveNBTServer(final EntityPlayer player, final NBTTagCompound action) {
final String name = action.getString("type");
if (this.handleNBT(side, player, name, action)) {
if (this.handleNBTServer(player, name, action)) {
return;
}
this.window.recieveGuiNBT(this.getSide(), player, name, action);
final INetwork.RecieveGuiNBT machine = Machine.getInterface(INetwork.RecieveGuiNBT.class, this.window.getInventory());
this.window.receiveGuiNBTOnServer(player, name, action);
final INetwork.ReceiveGuiNBT machine = Machine.getInterface(INetwork.ReceiveGuiNBT.class, this.window.getInventory());
if (machine != null) {
machine.recieveGuiNBT(this.getSide(), player, name, action);
machine.receiveGuiNBTOnServer(player, name, action);
}
}
@SideOnly(Side.CLIENT)
public void receiveNBTClient(final EntityPlayer player, final NBTTagCompound action) {
final String name = action.getString("type");
if (this.handleNBTClient(player, name, action)) {
return;
}
this.window.receiveGuiNBTOnClient(player, name, action);
final INetwork.ReceiveGuiNBT machine = Machine.getInterface(INetwork.ReceiveGuiNBT.class, this.window.getInventory());
if (machine != null) {
machine.receiveGuiNBTOnClient(player, name, action);
}
}
@@ -9,6 +9,8 @@ import binnie.craftgui.core.renderer.RenderUtil;
import binnie.craftgui.events.EventHandler;
import binnie.craftgui.events.EventMouse;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class Dialog extends Control {
public Dialog(final IWidget parent, final int w, final int h) {
@@ -34,6 +36,7 @@ public abstract class Dialog extends Control {
public abstract void onClose();
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawGradientRect(this.getArea().outset(400), -1442840576, -1442840576);
CraftGUI.render.texture(CraftGUITexture.Window, this.getArea());
@@ -47,7 +47,7 @@ import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Deque;
public abstract class Window extends TopLevelWidget implements INetwork.RecieveGuiNBT {
public abstract class Window extends TopLevelWidget implements INetwork.ReceiveGuiNBT {
@Nullable // client side only
private GuiCraftGUI gui;
private ContainerCraftGUI container;
@@ -289,19 +289,24 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
if (side == Side.CLIENT && name.equals("username")) {
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
}
@Override
public void receiveGuiNBTOnClient(EntityPlayer player, String name, NBTTagCompound nbt) {
if (name.equals("username")) {
final int w = this.w();
final int titleButtonRight = this.titleButtonRight + 16;
this.titleButtonRight = titleButtonRight;
final ControlUser controlUser = new ControlUser(this, w - titleButtonRight, 8, action.getString("username"));
final ControlUser controlUser = new ControlUser(this, w - titleButtonRight, 8, nbt.getString("username"));
this.titleButtonRight += 6;
}
if (side == Side.CLIENT && name.equals("power-system")) {
if (name.equals("power-system")) {
final int w2 = this.w();
final int titleButtonRight2 = this.titleButtonRight + 16;
this.titleButtonRight = titleButtonRight2;
final ControlPowerSystem controlPowerSystem = new ControlPowerSystem(this, w2 - titleButtonRight2, 8, PowerSystem.get(action.getByte("system")));
final ControlPowerSystem controlPowerSystem = new ControlPowerSystem(this, w2 - titleButtonRight2, 8, PowerSystem.get(nbt.getByte("system")));
this.titleButtonRight += 6;
}
}
@@ -19,6 +19,8 @@ import binnie.craftgui.minecraft.Window;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.inventory.IInventory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
@@ -76,6 +78,7 @@ public class ControlEnergyBar extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.EnergyBarBack, this.getArea());
final float percentage = this.getPercentage() / 100.0f;
@@ -109,6 +112,7 @@ public class ControlEnergyBar extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
final IArea area = this.getArea();
@@ -7,6 +7,8 @@ import binnie.craftgui.core.ITooltip;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlHelp extends Control implements ITooltip {
public ControlHelp(final IWidget parent, final int x, final int y) {
@@ -15,6 +17,7 @@ public class ControlHelp extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.HelpButton, this.getArea());
}
@@ -7,6 +7,8 @@ import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.core.renderer.RenderUtil;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlIconDisplay extends Control {
private TextureAtlasSprite sprite;
@@ -17,6 +19,7 @@ public class ControlIconDisplay extends Control {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
RenderUtil.drawSprite(IPoint.ZERO, this.sprite);
}
@@ -5,6 +5,8 @@ import binnie.craftgui.core.CraftGUI;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.resource.Texture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlImage extends Control {
private Object key;
@@ -15,6 +17,7 @@ public class ControlImage extends Control {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(this.key, IPoint.ZERO);
}
@@ -7,6 +7,8 @@ import binnie.craftgui.core.ITooltip;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlInfo extends Control implements ITooltip {
private String info;
@@ -18,6 +20,7 @@ public class ControlInfo extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.InfoButton, this.getArea());
}
@@ -8,6 +8,8 @@ import binnie.craftgui.core.ITooltip;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlPowerSystem extends Control implements ITooltip {
private PowerSystem system;
@@ -19,6 +21,7 @@ public class ControlPowerSystem extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.PowerButton, this.getArea());
}
@@ -4,6 +4,8 @@ import binnie.craftgui.core.CraftGUI;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.Position;
import binnie.craftgui.resource.Texture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlProgress extends ControlProgressBase {
private Texture progressBlank;
@@ -19,6 +21,7 @@ public class ControlProgress extends ControlProgressBase {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(this.progressBlank, this.getArea());
CraftGUI.render.texturePercentage(this.progressBar, this.getArea(), this.direction, this.progress);
@@ -128,6 +128,7 @@ public class ControlSlot extends ControlSlotBase {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderOverlay() {
boolean highlighted = false;
for (final Map.Entry<EnumHighlighting, List<Integer>> highlight : ControlSlot.highlighting.entrySet()) {
@@ -9,6 +9,8 @@ import binnie.craftgui.core.Tooltip;
import binnie.craftgui.core.geometry.Position;
import binnie.craftgui.minecraft.Window;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlSlotCharge extends Control {
private int slot;
@@ -19,6 +21,7 @@ public class ControlSlotCharge extends Control {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.PanelBlack, this.getArea());
CraftGUI.render.texturePercentage(CraftGUI.render.getTexture(CraftGUITexture.SlotCharge), this.getArea().inset(1), Position.Bottom, this.getCharge());
@@ -7,6 +7,8 @@ import binnie.craftgui.core.ITooltip;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Objects;
@@ -23,6 +25,7 @@ public class ControlUser extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.UserButton, this.getArea());
}
@@ -11,6 +11,8 @@ import binnie.craftgui.resource.Texture;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import binnie.craftgui.resource.minecraft.CraftGUITextureSheet;
import binnie.craftgui.resource.minecraft.StandardTexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
class ControlBreedingProgress extends Control {
private static Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.Controls2);
@@ -24,6 +26,7 @@ class ControlBreedingProgress extends Control {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.PanelBlack, this.getArea());
final IArea area = this.getArea().inset(1);
@@ -28,6 +28,7 @@ import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IClassification;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.Collection;
@@ -93,6 +94,7 @@ public abstract class WindowAbstractDatabase extends Window {
}
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
this.setSize(new IPoint(176 + this.selectionBoxWidth + 22 + 8, 208));
this.addEventHandler(new EventValueChanged.Handler() {
@@ -204,6 +206,7 @@ public abstract class WindowAbstractDatabase extends Window {
}
@Override
@SideOnly(Side.CLIENT)
public void onUpdateClient() {
super.onUpdateClient();
if (this.gotoSpecies != null) {
@@ -1,5 +1,9 @@
package binnie.craftgui.resource;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IStyleSheet {
@SideOnly(Side.CLIENT)
Texture getTexture(final Object p0);
}
@@ -1,5 +1,8 @@
package binnie.craftgui.resource;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.HashMap;
import java.util.Map;
@@ -11,6 +14,7 @@ public class StyleSheet implements IStyleSheet {
}
@Override
@SideOnly(Side.CLIENT)
public Texture getTexture(final Object key) {
if (!this.textures.containsKey(key)) {
return StyleSheetManager.getTexture(key);
@@ -1,10 +1,13 @@
package binnie.craftgui.resource;
import binnie.craftgui.core.CraftGUI;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class StyleSheetManager {
static IStyleSheet defaultSS = new DefaultStyleSheet();
@SideOnly(Side.CLIENT)
public static Texture getTexture(final Object key) {
return StyleSheetManager.defaultSS.getTexture(key);
}
@@ -15,6 +18,7 @@ public class StyleSheetManager {
private static class DefaultStyleSheet implements IStyleSheet {
@Override
@SideOnly(Side.CLIENT)
public Texture getTexture(final Object key) {
return CraftGUI.resourceManager.getTexture(key.toString());
}
@@ -6,6 +6,8 @@ import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.minecraft.MinecraftGUI;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class Panel extends Control {
IPanelType type;
@@ -24,6 +26,7 @@ public class Panel extends Control {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
final IPanelType panelType = this.getType();
if (panelType instanceof MinecraftGUI.PanelType) {
@@ -13,6 +13,8 @@ import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
@@ -43,6 +45,7 @@ public class ControlBiomes extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
for (int i = 0; i < this.tolerated.size(); ++i) {
final int x = i % 8 * 16;
@@ -16,6 +16,8 @@ import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IAllele;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
@@ -65,6 +67,7 @@ public class ControlClimateBar extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.EnergyBarBack, this.getArea());
final int types = this.isHumidity ? 3 : 6;
@@ -9,6 +9,8 @@ import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.core.renderer.RenderUtil;
import forestry.api.genetics.IChromosomeType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
@@ -32,6 +34,7 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome, this.getArea());
RenderUtil.setColour(16711680);
@@ -10,6 +10,8 @@ import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.LinkedList;
import java.util.List;
@@ -23,6 +25,7 @@ public class ControlPunnett extends Control {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawSolidRect(new IArea(0, ControlPunnett.boxHeight, ControlPunnett.boxWidth * 3, 1), 11184810);
RenderUtil.drawSolidRect(new IArea(ControlPunnett.boxWidth / 2, ControlPunnett.boxHeight * 2, Math.round(ControlPunnett.boxWidth * 2.5f), 1), 11184810);
@@ -14,6 +14,7 @@ import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
@@ -44,6 +45,7 @@ public class WindowPunnettSquare extends Window {
}
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
this.setTitle("Punnett Square");
CraftGUI.render.setStyleSheet(new StyleSheetPunnett());
@@ -10,6 +10,8 @@ import forestry.arboriculture.items.ItemBlockLeaves;
import forestry.core.items.IColoredItem;
import forestry.core.items.ItemBlockForestry;
import forestry.core.utils.Translator;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemBlockETDecorativeLeaves extends ItemBlockForestry<BlockETDecorativeLeaves> implements IColoredItem {
public ItemBlockETDecorativeLeaves(Block block) {
@@ -30,6 +32,7 @@ public class ItemBlockETDecorativeLeaves extends ItemBlockForestry<BlockETDecora
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemstack(ItemStack itemStack, int renderPass) {
int meta = itemStack.getMetadata();
BlockETDecorativeLeaves block = getBlock();
@@ -1,9 +1,6 @@
package binnie.extratrees.genetics;
import binnie.Constants;
import binnie.extratrees.block.EnumETLog;
import forestry.api.arboriculture.EnumForestryWoodType;
import forestry.api.arboriculture.EnumVanillaWoodType;
import com.google.common.base.Preconditions;
import forestry.api.arboriculture.IWoodProvider;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
@@ -15,26 +12,28 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.FMLClientHandler;
import javax.annotation.Nonnull;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
public class WoodProvider implements IWoodProvider {
private IWoodType type;
@SideOnly(Side.CLIENT)
@Nullable
private TextureAtlasSprite trunk;
@SideOnly(Side.CLIENT)
@Nullable
private TextureAtlasSprite bark;
private String modID = "";
public WoodProvider(IWoodType type) {
this.type = type;
if (type instanceof EnumETLog) {
modID = Constants.EXTRA_TREES_MOD_ID;
} else if (type instanceof EnumVanillaWoodType) {
modID = "minecraft";
} else if (type instanceof EnumForestryWoodType) {
modID = "forestry";
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerSprites(Item item, ITextureManager manager) {
TextureMap textureMap = FMLClientHandler.instance().getClient().getTextureMapBlocks();
trunk = textureMap.registerSprite(new ResourceLocation(type.getHeartTexture()));
@@ -43,10 +42,13 @@ public class WoodProvider implements IWoodProvider {
}
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getSprite(boolean isTop) {
if (isTop) {
Preconditions.checkState(trunk != null, "sprites have not been registered");
return trunk;
} else {
Preconditions.checkState(bark != null, "sprites have not been registered");
return bark;
}
}
@@ -18,6 +18,8 @@ import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class DistilleryRecipeCategory extends BlankRecipeCategory<DistilleryRecipeWrapper> {
private static final Texture DISTILLERY_BASE = new StandardTexture(43, 0, 58, 60, ExtraTreeTexture.Gui);
@@ -45,6 +47,7 @@ public class DistilleryRecipeCategory extends BlankRecipeCategory<DistilleryReci
}
@Override
@SideOnly(Side.CLIENT)
public void drawExtras(Minecraft minecraft) {
CraftGUI.render.texture(DISTILLERY_BASE, IPoint.ZERO);
CraftGUI.render.texturePercentage(LIQUID_FLOW, new IArea(18, 0, 38, 60), Position.Left, progress.getValue() / 100f);
@@ -7,6 +7,8 @@ import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class DistilleryRecipeWrapper extends BlankRecipeWrapper {
private final int level;
@@ -26,6 +28,7 @@ public class DistilleryRecipeWrapper extends BlankRecipeWrapper {
}
@Override
@SideOnly(Side.CLIENT)
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
@@ -40,6 +40,7 @@ public class ControlSlotFluid extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
final int size = this.getSize().x();
CraftGUI.render.texture(CraftGUITexture.Slot, this.getArea());
@@ -18,7 +18,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import javax.annotation.Nullable;
import java.util.Map;
@@ -137,32 +136,6 @@ public abstract class Designer {
return this.design;
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound nbt) {
if (name.equals("recipe")) {
final InventoryPlayer playerInv = player.inventory;
final ItemStack recipe = this.doRecipe(false);
if (!recipe.isEmpty()) {
if (playerInv.getItemStack().isEmpty()) {
playerInv.setItemStack(this.doRecipe(true));
} else if (playerInv.getItemStack().isItemEqual(recipe) && ItemStack.areItemStackTagsEqual(playerInv.getItemStack(), recipe)) {
final int fit = recipe.getMaxStackSize() - (recipe.getCount() + playerInv.getItemStack().getCount());
if (fit >= 0) {
this.doRecipe(true);
recipe.grow(playerInv.getItemStack().getCount());
playerInv.setItemStack(recipe);
}
}
player.openContainer.detectAndSendChanges();
if (player instanceof EntityPlayerMP) {
((EntityPlayerMP) player).updateHeldItem();
}
}
} else if (name.equals("design")) {
this.setDesign(CarpentryManager.carpentryInterface.getDesign(nbt.getShort("d")));
}
}
private void setDesign(final IDesign design) {
this.design = design;
}
@@ -183,12 +156,43 @@ public abstract class Designer {
}
@Override
public void sendGuiNBT(final Map<String, NBTTagCompound> nbt) {
public void sendGuiNBTToClient(final Map<String, NBTTagCompound> nbt) {
final NBTTagCompound tag = new NBTTagCompound();
tag.setShort("d", (short) CarpentryManager.carpentryInterface.getDesignIndex(this.getDesign()));
nbt.put("design", tag);
}
@Override
public void receiveGuiNBTOnClient(EntityPlayer player, String name, NBTTagCompound nbt) {
if (name.equals("design")) {
this.setDesign(CarpentryManager.carpentryInterface.getDesign(nbt.getShort("d")));
}
}
@Override
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
if (name.equals("recipe")) {
final InventoryPlayer playerInv = player.inventory;
final ItemStack recipe = this.doRecipe(false);
if (!recipe.isEmpty()) {
if (playerInv.getItemStack().isEmpty()) {
playerInv.setItemStack(this.doRecipe(true));
} else if (playerInv.getItemStack().isItemEqual(recipe) && ItemStack.areItemStackTagsEqual(playerInv.getItemStack(), recipe)) {
final int fit = recipe.getMaxStackSize() - (recipe.getCount() + playerInv.getItemStack().getCount());
if (fit >= 0) {
this.doRecipe(true);
recipe.grow(playerInv.getItemStack().getCount());
playerInv.setItemStack(recipe);
}
}
player.openContainer.detectAndSendChanges();
if (player instanceof EntityPlayerMP) {
((EntityPlayerMP) player).updateHeldItem();
}
}
}
}
public DesignerType getDesignerType() {
return this.type;
}
@@ -5,6 +5,8 @@ import binnie.core.resource.BinnieResource;
import binnie.core.resource.ResourceType;
import binnie.extratrees.ExtraTrees;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class MachineRendererNursery {
public static MachineRendererNursery instance = new MachineRendererNursery();
@@ -17,6 +19,7 @@ public class MachineRendererNursery {
this.model = new ModelNursery();
}
@SideOnly(Side.CLIENT)
public void renderMachine(final BinnieResource texture, final double x, final double y, final double z, final float var8) {
this.texture = texture;
GlStateManager.pushMatrix();
@@ -3,6 +3,8 @@ package binnie.extratrees.machines;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ModelNursery extends ModelBase {
ModelRenderer Shape1;
@@ -90,6 +92,7 @@ public class ModelNursery extends ModelBase {
}
@Override
@SideOnly(Side.CLIENT)
public void render(final Entity entity, final float f, final float f1, final float f2, final float f3, final float f4, final float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
@@ -11,7 +11,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import javax.annotation.Nullable;
import java.util.Map;
@@ -87,7 +86,7 @@ public class BreweryLogic extends ComponentProcessSetCost implements IProcess, I
}
@Override
public void sendGuiNBT(final Map<String, NBTTagCompound> data) {
public void sendGuiNBTToClient(final Map<String, NBTTagCompound> data) {
final NBTTagCompound nbt = new NBTTagCompound();
if (this.currentCrafting == null) {
nbt.setBoolean("null", true);
@@ -98,7 +97,12 @@ public class BreweryLogic extends ComponentProcessSetCost implements IProcess, I
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound nbt) {
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
}
@Override
public void receiveGuiNBTOnClient(EntityPlayer player, String name, NBTTagCompound nbt) {
if (name.equals("brewery-recipe")) {
if (nbt.getBoolean("null")) {
this.currentCrafting = null;
@@ -5,6 +5,8 @@ import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.core.renderer.RenderUtil;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlBlockIconDisplay extends Control {
TextureAtlasSprite icon;
@@ -15,6 +17,7 @@ public class ControlBlockIconDisplay extends Control {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawSprite(IPoint.ZERO, this.icon);
}
@@ -16,6 +16,8 @@ import binnie.extratrees.core.ExtraTreeTexture;
import binnie.extratrees.machines.brewery.BreweryLogic;
import binnie.extratrees.machines.brewery.BreweryRecipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import java.util.Collections;
@@ -25,6 +27,7 @@ public class ControlBreweryProgress extends ControlProgressBase {
static Texture BreweryOverlay = new StandardTexture(34, 69, 34, 39, ExtraTreeTexture.Gui);
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(ControlBreweryProgress.Brewery, IPoint.ZERO);
final BreweryLogic logic = Machine.getInterface(BreweryLogic.class, Window.get(this).getInventory());
@@ -27,6 +27,7 @@ public class ControlDistilleryProgress extends ControlProgressBase {
public static final Texture OUTPUT = new StandardTexture(68, 66, 17, 7, ExtraTreeTexture.Gui);
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(DISTILLERY_BASE, IPoint.ZERO);
CraftGUI.render.texturePercentage(LIQUID_FLOW, new IArea(18, 0, 38, 66), Position.Left, this.progress);
@@ -28,6 +28,7 @@ public class ControlFruitPressProgress extends ControlProgressBase {
private static final Texture PressSlot = new StandardTexture(9, 52, 34, 17, ExtraTreeTexture.Gui);
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(ControlFruitPressProgress.PressSlot, new IPoint(3, 52));
ContainerCraftGUI container = Window.get(this).getContainer();
@@ -157,11 +157,13 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.Slot, IPoint.ZERO);
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
final ItemStack image = ((WindowWoodworker) this.getTopParent()).getDesignerType().getDisplayStack(this.getValue());
RenderUtil.drawItem(new IPoint(1, 1), image);
@@ -58,10 +58,10 @@ public class WindowPress extends Window {
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
super.receiveGuiNBTOnServer(player, name, nbt);
final FruitPressLogic logic = Machine.getInterface(FruitPressLogic.class, this.getInventory());
super.recieveGuiNBT(side, player, name, action);
if (logic != null && side == Side.SERVER) {
if (logic != null) {
if (name.equals("fruitpress-click") && logic.canWork() == null && (logic.canProgress() == null || logic.canProgress() instanceof ErrorState.InsufficientPower)) {
logic.alterProgress(2.0f);
} else if (name.equals("clear-fruit")) {
@@ -23,6 +23,7 @@ import binnie.extratrees.machines.DesignerType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
@@ -31,6 +32,7 @@ public class WindowWoodworker extends Window {
ControlTileSelect tileSelect;
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName());
new ControlText(this, new IArea(190, 36, 114, 10), BinnieCore.getBinnieProxy().localise("gui.design"), TextJustification.TopCenter).setColour(4473924);
@@ -9,12 +9,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import javax.annotation.Nullable;
import java.util.Map;
public class DistilleryLogic extends ComponentProcessSetCost implements IProcess, INetwork.SendGuiNBT, INetwork.RecieveGuiNBT {
public class DistilleryLogic extends ComponentProcessSetCost implements IProcess, INetwork.SendGuiNBT, INetwork.ReceiveGuiNBT {
public static final int INPUT_FLUID_AMOUNT = Fluid.BUCKET_VOLUME;
@Nullable
@@ -101,7 +100,12 @@ public class DistilleryLogic extends ComponentProcessSetCost implements IProcess
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound nbt) {
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
}
@Override
public void receiveGuiNBTOnClient(EntityPlayer player, String name, NBTTagCompound nbt) {
if (name.equals("still-level")) {
this.level = nbt.getByte("i");
this.setProgress(0);
@@ -116,7 +120,7 @@ public class DistilleryLogic extends ComponentProcessSetCost implements IProcess
}
@Override
public void sendGuiNBT(final Map<String, NBTTagCompound> data) {
public void sendGuiNBTToClient(final Map<String, NBTTagCompound> data) {
final NBTTagCompound nbt = new NBTTagCompound();
if (this.currentFluid == null) {
nbt.setBoolean("null", true);
@@ -13,6 +13,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
@@ -47,6 +49,7 @@ public class GeneArrayItem implements INbtReadable, INbtWritable, IGeneItem {
}
@Override
@SideOnly(Side.CLIENT)
public void getInfo(final List<String> list) {
final List<String> totalList = new ArrayList<>();
@@ -12,6 +12,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.List;
@@ -53,6 +55,7 @@ public class GeneItem implements INbtWritable, IGeneItem {
}
@Override
@SideOnly(Side.CLIENT)
public void getInfo(final List<String> list) {
final String chromosomeName = this.getBreedingSystem().getChromosomeName(this.gene.getChromosome());
list.add(TextFormatting.GOLD + chromosomeName + TextFormatting.GRAY + ": " + this.gene.getName());
@@ -3,6 +3,8 @@ package binnie.genetics.genetics;
import binnie.genetics.api.IGene;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.List;
@@ -11,6 +13,7 @@ public interface IGeneItem {
@Nullable
ISpeciesRoot getSpeciesRoot();
@SideOnly(Side.CLIENT)
void getInfo(final List<String> p0);
int getColour(final int p0);
@@ -16,7 +16,10 @@ import forestry.api.lepidopterology.IAlleleButterflyEffect;
import forestry.api.lepidopterology.IButterfly;
import forestry.apiculture.PluginApiculture;
import net.minecraft.util.math.Vec3i;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class AnalystPageBehaviour extends ControlAnalystPage {
public AnalystPageBehaviour(final IWidget parent, final IArea area, final IIndividual ind) {
super(parent, area);
@@ -20,6 +20,8 @@ import binnie.craftgui.window.Panel;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
@@ -67,6 +69,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.setColour(5592405);
CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().inset(1));
@@ -100,6 +103,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
IAlleleSpecies value = v;
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawText(this.getArea(), TextJustification.MiddleCenter, this.value.getName(), 16777215);
}
@@ -112,6 +116,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
}
new ControlScrollBar(this, this.scroll.x() + this.scroll.w() - 6, this.scroll.y() + 3, 3, this.scroll.h() - 6, this.scroll) {
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
if (!this.isEnabled()) {
return;
@@ -137,6 +142,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
public void initialise() {
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
@SideOnly(Side.CLIENT)
public void onEvent(final EventMouse.Down event) {
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent();
window.setIndividual(ind);
@@ -145,6 +151,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent();
if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) {
@@ -9,9 +9,12 @@ import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.core.geometry.TextJustification;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Objects;
@SideOnly(Side.CLIENT)
public class AnalystPageDescription extends ControlAnalystPage {
public AnalystPageDescription(final IWidget parent, final IArea area, final IIndividual ind) {
super(parent, area);
@@ -19,6 +19,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class AnalystPageGenome extends ControlAnalystPage {
boolean active;
@@ -24,6 +24,8 @@ import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IMutation;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Collection;
import java.util.List;
@@ -129,6 +131,7 @@ public class AnalystPageMutations extends ControlAnalystPage {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawItem(IPoint.ZERO, system.getDefaultMember(mutation.getAllele0().getUID()));
RenderUtil.drawItem(new IPoint(28, 0), system.getDefaultMember(mutation.getAllele1().getUID()));
@@ -187,6 +190,7 @@ public class AnalystPageMutations extends ControlAnalystPage {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawItem(IPoint.ZERO, system.getDefaultMember(speciesComb.getUID()));
RenderUtil.drawItem(new IPoint(28, 0), system.getDefaultMember(mutation.getTemplate()[0].getUID()));
@@ -256,6 +260,7 @@ public class AnalystPageMutations extends ControlAnalystPage {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawText(this.getArea(), TextJustification.MiddleCenter, "UNKNOWN", 11184810);
}
@@ -24,6 +24,8 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
@@ -154,6 +156,7 @@ public class AnalystPageProducts extends AnalystPageProduce {
private void createProductEntry(final ItemStack key, final Float value, final int y, final float speed) {
final ControlItemDisplay item = new ControlItemDisplay(this, 16, y) {
@Override
@SideOnly(Side.CLIENT)
public void getTooltip(final Tooltip tooltip) {
super.getTooltip(tooltip);
final Collection<ItemStack> products = AnalystPageProducts.this.getCentrifuge(key);
@@ -15,6 +15,8 @@ import binnie.craftgui.resource.minecraft.StandardTexture;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlAnalystChromosome extends Control implements ITooltip {
IAllele allele0;
@@ -40,6 +42,7 @@ public class ControlAnalystChromosome extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
CraftGUI.render.texture(this.isHomozygous() ? this.Homozygous : this.Heterozygous, IPoint.ZERO);
@@ -13,6 +13,8 @@ import binnie.craftgui.resource.Texture;
import binnie.craftgui.resource.minecraft.StandardTexture;
import binnie.extrabees.core.ExtraBeeTexture;
import forestry.api.genetics.IChromosomeType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlChromoPicker extends Control implements ITooltip {
Texture Selected;
@@ -42,6 +44,7 @@ public class ControlChromoPicker extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
final boolean selected = this.isMouseOver();
@@ -6,6 +6,8 @@ import binnie.craftgui.controls.listbox.ControlOption;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.TextJustification;
import binnie.craftgui.core.renderer.RenderUtil;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlGenesisOption extends ControlOption<Gene> {
public ControlGenesisOption(final ControlList<Gene> parent, final Gene gene, final int y) {
@@ -21,6 +23,7 @@ public class ControlGenesisOption extends ControlOption<Gene> {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
RenderUtil.drawText(new IArea(0, 0, 70, 22), TextJustification.MiddleCenter, this.getChromosomeName(), this.getColour());
@@ -12,6 +12,8 @@ import binnie.craftgui.core.renderer.RenderUtil;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.EnumTolerance;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.EnumSet;
@@ -47,6 +49,7 @@ public abstract class ControlToleranceBar<T extends Enum<T>> extends Control imp
protected abstract int getColour(final T p0);
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawGradientRect(this.getArea(), -1431655766, -1431655766);
final int w = this.getArea().w() / this.fullSet.size();
@@ -128,6 +128,7 @@ public class WindowAnalyst extends Window {
}
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
this.setTitle(this.isDatabase ? (this.isMaster ? "Master Registry" : "Registry") : "Analyst");
final BreedingSystem system = Binnie.GENETICS.beeBreedingSystem;
@@ -145,6 +146,7 @@ public class WindowAnalyst extends Window {
this.addAttribute(Attribute.MouseOver);
this.addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
@SideOnly(Side.CLIENT)
public void onEvent(final EventMouse.Down event) {
WindowAnalyst.this.setSystem(syst);
}
@@ -273,6 +275,7 @@ public class WindowAnalyst extends Window {
this.setSystem(Binnie.GENETICS.beeBreedingSystem);
}
@SideOnly(Side.CLIENT)
public void setIndividual(final IIndividual ind) {
if (!this.isDatabase) {
if (ind == null) {
@@ -293,6 +296,7 @@ public class WindowAnalyst extends Window {
this.updatePages(systemChange);
}
@SideOnly(Side.CLIENT)
public void setSystem(final BreedingSystem system) {
if (system == this.currentSystem) {
return;
@@ -302,6 +306,7 @@ public class WindowAnalyst extends Window {
this.updatePages(true);
}
@SideOnly(Side.CLIENT)
public void updatePages(final boolean systemChange) {
int oldLeft = -1;
int oldRight = -1;
@@ -475,13 +480,14 @@ public class WindowAnalyst extends Window {
if (ind != null) {
ind.getGenome().getSpeciesRoot().getBreedingTracker(this.getWorld(), this.getUsername()).registerBirth(ind);
}
// TODO why is this specific client/server code needed?
if (this.isClient()) {
//noinspection MethodCallSideOnly
this.setStack(this.getWindowInventory().getStackInSlot(0));
} else if (this.isServer()) {
}
}
@SideOnly(Side.CLIENT)
public void setStack(final ItemStack stack) {
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
this.setIndividual(ind);
@@ -9,6 +9,8 @@ import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.awt.Color;
import java.util.ArrayList;
@@ -40,6 +42,7 @@ public class GenepoolRecipeWrapper extends BlankRecipeWrapper {
}
@Override
@SideOnly(Side.CLIENT)
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
float usedEnzyme = GenepoolLogic.ENZYME_PER_PROCESS;
String usedString = String.format("%.2f", usedEnzyme);
@@ -11,6 +11,8 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.awt.*;
@@ -37,6 +39,7 @@ public class IsolatorRecipeCategory extends BlankRecipeCategory<IsolatorRecipeWr
}
@Override
@SideOnly(Side.CLIENT)
public void drawExtras(Minecraft minecraft) {
IDrawable tank = GeneticsJeiPlugin.drawables.getTank();
tank.draw(minecraft, 0, 0);
@@ -8,6 +8,8 @@ import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.awt.*;
import java.util.ArrayList;
@@ -40,6 +42,7 @@ public class IsolatorRecipeWrapper extends BlankRecipeWrapper {
}
@Override
@SideOnly(Side.CLIENT)
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
float loss = IsolatorLogic.TARGET_LOSS_CHANCE;
String lossString = String.format("Loss: %.0f%%", loss * 100);
@@ -17,6 +17,8 @@ import binnie.genetics.core.GeneticsTexture;
import binnie.genetics.genetics.Engineering;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlGene extends Control implements IControlValue<IGene>, ITooltip {
private IGene gene;
@@ -74,6 +76,7 @@ public class ControlGene extends Control implements IControlValue<IGene>, IToolt
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
if (this.isMouseOver() && this.canFill(Window.get(this).getHeldItemStack())) {
RenderUtil.drawSolidRect(this.getArea(), -1);
@@ -5,6 +5,8 @@ import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.core.renderer.RenderUtil;
import binnie.craftgui.minecraft.control.ControlMachineProgress;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlProcessTemporary extends ControlMachineProgress {
public ControlProcessTemporary(final IWidget parent, final int x, final int y, final int width, final int height) {
@@ -13,6 +15,7 @@ public class ControlProcessTemporary extends ControlMachineProgress {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawSolidRect(this.getArea(), -4868683);
final int w = Math.round(this.getSize().y() * this.progress / 100.0f);
@@ -4,6 +4,8 @@ import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.renderer.RenderUtil;
import binnie.craftgui.minecraft.control.ControlProgressBase;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlSplicerProgress extends ControlProgressBase {
float strength;
@@ -15,6 +17,7 @@ public class ControlSplicerProgress extends ControlProgressBase {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
final float progress = this.getProcess().getCurrentProgress() / 100.0f;
final float n = this.getProcess().getProcessTime() / 12.0f;
@@ -30,6 +30,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Arrays;
import java.util.List;
@@ -41,10 +42,10 @@ public class WindowGeneBank extends WindowMachine {
ControlGeneScroll genes;
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
super.recieveGuiNBT(side, player, name, action);
if (side == Side.SERVER && name.equals("gene-select")) {
final Gene gene = new Gene(action.getCompoundTag("gene"));
public void receiveGuiNBTOnServer(final EntityPlayer player, final String name, final NBTTagCompound nbt) {
super.receiveGuiNBTOnServer(player, name, nbt);
if (name.equals("gene-select")) {
final Gene gene = new Gene(nbt.getCompoundTag("gene"));
if (gene != null && !false) {
final ItemStack held = this.getHeldItemStack();
final ItemStack converted = Engineering.addGene(held, gene);
@@ -75,8 +76,9 @@ public class WindowGeneBank extends WindowMachine {
}
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
this.setTitle("Gene Bank");
super.initialiseClient();
this.addEventHandler(new EventValueChanged.Handler() {
@Override
public void onEvent(final EventValueChanged event) {
@@ -19,6 +19,7 @@ import binnie.genetics.machine.incubator.Incubator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class WindowIncubator extends WindowMachine {
static Texture ProgressBase = new StandardTexture(0, 91, 38, 32, GeneticsTexture.GUIProcess);
@@ -29,6 +30,7 @@ public class WindowIncubator extends WindowMachine {
}
@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
super.initialiseClient();
int x = 16;
@@ -36,11 +36,12 @@ public class WindowSequencer extends WindowMachine {
}
@Override
public void recieveGuiNBT(final Side side, final EntityPlayer player, final String name, final NBTTagCompound action) {
if (side == Side.CLIENT && name.equals("username")) {
this.slotText.setValue(TextFormatting.DARK_GRAY + String.format(Genetics.proxy.localise("machine.machine.sequencer.texts.sequenced.by"), action.getString("username")));
@SideOnly(Side.CLIENT)
public void receiveGuiNBTOnClient(EntityPlayer player, String name, NBTTagCompound nbt) {
if (name.equals("username")) {
this.slotText.setValue(TextFormatting.DARK_GRAY + String.format(Genetics.proxy.localise("machine.machine.sequencer.texts.sequenced.by"), nbt.getString("username")));
}
super.recieveGuiNBT(side, player, name, action);
super.receiveGuiNBTOnClient(player, name, nbt);
}
@Override
@@ -21,35 +21,43 @@ public class GenepoolFX extends MachineComponent implements IRender.DisplayTick
@Override
public void onDisplayTick(World world, BlockPos pos, Random rand) {
if (rand.nextFloat() < 1.0f && this.getUtil().getProcess().isInProgress()) {
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.3 + rand.nextDouble() * 0.4, pos.getY() + 1, pos.getZ() + 0.3 + rand.nextDouble() * 0.4, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = this.rand.nextDouble() * 2.0 * 3.1415;
final Particle particle = new GenepoolParticle(world, pos, rand);
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(particle);
}
}
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = this.rand.nextFloat() * 0.01;
this.particleMaxAge = 25;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.4f + 0.6f * this.rand.nextFloat(), 0.6f * this.rand.nextFloat(), 0.6f + 0.4f * this.rand.nextFloat());
}
@SideOnly(Side.CLIENT)
private static class GenepoolParticle extends Particle {
double axisX;
double axisZ;
double angle;
@Override
public void onUpdate() {
super.onUpdate();
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
}
public GenepoolParticle(World world, BlockPos pos, Random rand) {
super(world, pos.getX() + 0.3 + rand.nextDouble() * 0.4, pos.getY() + 1, pos.getZ() + 0.3 + rand.nextDouble() * 0.4, 0.0, 0.0, 0.0);
axisX = this.posX;
axisZ = this.posZ;
angle = this.rand.nextDouble() * 2.0 * 3.1415;
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = this.rand.nextFloat() * 0.01;
this.particleMaxAge = 25;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.4f + 0.6f * this.rand.nextFloat(), 0.6f * this.rand.nextFloat(), 0.6f + 0.4f * this.rand.nextFloat());
}
@Override
public int getFXLayer() {
return 0;
}
});
@Override
public void onUpdate() {
super.onUpdate();
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
}
}
@@ -32,45 +32,8 @@ public class InoculatorFX extends MachineComponent implements IRender.DisplayTic
public void onDisplayTick(World world, BlockPos pos, Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 3L);
if (tick == 0 && this.getUtil().getProcess().isInProgress()) {
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 0.92, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = (int) (this.world.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.007 + this.rand.nextDouble() * 0.002;
this.particleMaxAge = 240;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.8f, 0.0f, 1.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
double speed = 5.0E-4;
if (this.particleAge > 60) {
speed += (this.particleAge - 60) / 4000.0f;
}
this.angle += speed;
final double dist = 0.27;
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
if (this.particleAge > 40) {
this.setRBGColorF(this.particleRed + (1.0f - this.particleRed) / 10.0f, this.particleGreen + (0.0f - this.particleGreen) / 10.0f, this.particleBlue + (0.0f - this.particleBlue) / 10.0f);
}
}
@Override
public int getFXLayer() {
return 0;
}
});
final Particle particle = new InoculatorParticle(world, pos);
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(particle);
}
}
@@ -126,4 +89,49 @@ public class InoculatorFX extends MachineComponent implements IRender.DisplayTic
}
this.getUtil().refreshBlock();
}
@SideOnly(Side.CLIENT)
private static class InoculatorParticle extends Particle {
double axisX;
double axisZ;
double angle;
public InoculatorParticle(World world, BlockPos pos) {
super(world, pos.getX() + 0.5, pos.getY() + 0.92, pos.getZ() + 0.5, 0.0, 0.0, 0.0);
axisX = this.posX;
axisZ = this.posZ;
angle = (int) (this.world.getTotalWorldTime() % 4L) * 0.5 * 3.1415;
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.007 + this.rand.nextDouble() * 0.002;
this.particleMaxAge = 240;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.8f, 0.0f, 1.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
double speed = 5.0E-4;
if (this.particleAge > 60) {
speed += (this.particleAge - 60) / 4000.0f;
}
this.angle += speed;
final double dist = 0.27;
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
if (this.particleAge > 40) {
this.setRBGColorF(this.particleRed + (1.0f - this.particleRed) / 10.0f, this.particleGreen + (0.0f - this.particleGreen) / 10.0f, this.particleBlue + (0.0f - this.particleBlue) / 10.0f);
}
}
@Override
public int getFXLayer() {
return 0;
}
}
}
@@ -23,33 +23,8 @@ public class IsolaterFX extends MachineComponent implements IRender.RandomDispla
if (!this.getUtil().getProcess().isInProgress()) {
return;
}
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.4 + 0.2 * rand.nextDouble(), pos.getY() + 1.6, pos.getZ() + 0.4 + rand.nextDouble() * 0.2, 0.0, 0.0, 0.0) {
double axisX = 0.0;
double axisZ = 0.0;
double angle = 0.0;
{
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = -0.012;
this.particleMaxAge = 100;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.8f, 0.4f, 0.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.06;
this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
final Particle particle = new IsolaterParticleRandomTick(world, pos, rand);
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(particle);
}
@SideOnly(Side.CLIENT)
@@ -57,37 +32,78 @@ public class IsolaterFX extends MachineComponent implements IRender.RandomDispla
public void onDisplayTick(World world, BlockPos pos, Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 6L);
if ((tick == 0 || tick == 5) && this.getUtil().getProcess().isInProgress()) {
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = 0.7 + (int) (this.world.getTotalWorldTime() % 2L) * 3.1415;
final Particle particle = new IsolaterParticle(world, pos);
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(particle);
}
}
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.012;
this.particleMaxAge = 100;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.8f, 0.0f, 1.0f);
}
@SideOnly(Side.CLIENT)
private static class IsolaterParticleRandomTick extends Particle {
double axisX;
double axisZ;
double angle;
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.06;
this.setPosition(this.axisX + 0.26 * Math.sin(this.angle), this.posY, this.axisZ + 0.26 * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
}
public IsolaterParticleRandomTick(World world, BlockPos pos, Random rand) {
super(world, pos.getX() + 0.4 + 0.2 * rand.nextDouble(), pos.getY() + 1.6, pos.getZ() + 0.4 + rand.nextDouble() * 0.2, 0.0, 0.0, 0.0);
axisX = 0.0;
axisZ = 0.0;
angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = -0.012;
this.particleMaxAge = 100;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.8f, 0.4f, 0.0f);
}
@Override
public int getFXLayer() {
return 0;
}
});
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.06;
this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
}
@SideOnly(Side.CLIENT)
private static class IsolaterParticle extends Particle {
double axisX;
double axisZ;
double angle;
public IsolaterParticle(World world, BlockPos pos) {
super(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0, 0.0, 0.0);
axisX = this.posX;
axisZ = this.posZ;
angle = 0.7 + (int) (this.world.getTotalWorldTime() % 2L) * 3.1415;
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.012;
this.particleMaxAge = 100;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.8f, 0.0f, 1.0f);
}
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.06;
this.setPosition(this.axisX + 0.26 * Math.sin(this.angle), this.posY, this.axisZ + 0.26 * Math.cos(this.angle));
this.setAlphaF((float) Math.cos(1.57 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
}
}
@@ -22,51 +22,59 @@ public class PolymeriserFX extends MachineComponent implements IRender.DisplayTi
public void onDisplayTick(World world, BlockPos pos, Random rand) {
final int tick = (int) (world.getTotalWorldTime() % 8L);
if ((tick == 0 || tick == 3) && this.getUtil().getProcess().isInProgress()) {
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1.8, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = 0.7 + (int) (this.world.getTotalWorldTime() % 2L) * 3.1415;
PolymeriserParticle polymeriserParticle = new PolymeriserParticle(world, pos);
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(polymeriserParticle);
}
}
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = -0.006;
this.particleMaxAge = 140;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.8f, 0.0f, 1.0f);
}
@SideOnly(Side.CLIENT)
private static class PolymeriserParticle extends Particle {
double axisX;
double axisZ;
double angle;
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.1;
this.motionY = -0.006;
double dist = 0.2;
if (this.particleAge > 60) {
if (this.particleAge > 120) {
dist = 0.1;
} else {
dist = 0.2 - 0.1 * ((this.particleAge - 60.0f) / 60.0f);
}
}
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
if (this.particleAge <= 40) {
this.setAlphaF(this.particleAge / 40.0f);
}
if (this.particleAge > 80) {
this.setRBGColorF(this.particleRed + (0.0f - this.particleRed) / 10.0f, this.particleGreen + (1.0f - this.particleGreen) / 10.0f, this.particleBlue + (1.0f - this.particleBlue) / 10.0f);
}
}
public PolymeriserParticle(World world, BlockPos pos) {
super(world, pos.getX() + 0.5, pos.getY() + 1.8, pos.getZ() + 0.5, 0.0, 0.0, 0.0);
axisX = this.posX;
axisZ = this.posZ;
angle = 0.7 + (int) (this.world.getTotalWorldTime() % 2L) * 3.1415;
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = -0.006;
this.particleMaxAge = 140;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.8f, 0.0f, 1.0f);
}
@Override
public int getFXLayer() {
return 0;
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.1;
this.motionY = -0.006;
double dist = 0.2;
if (this.particleAge > 60) {
if (this.particleAge > 120) {
dist = 0.1;
} else {
dist = 0.2 - 0.1 * ((this.particleAge - 60.0f) / 60.0f);
}
});
}
this.setPosition(this.axisX + dist * Math.sin(this.angle), this.posY, this.axisZ + dist * Math.cos(this.angle));
if (this.particleAge <= 40) {
this.setAlphaF(this.particleAge / 40.0f);
}
if (this.particleAge > 80) {
this.setRBGColorF(this.particleRed + (0.0f - this.particleRed) / 10.0f, this.particleGreen + (1.0f - this.particleGreen) / 10.0f, this.particleBlue + (1.0f - this.particleBlue) / 10.0f);
}
}
@Override
public int getFXLayer() {
return 0;
}
}
}
@@ -23,38 +23,8 @@ public class SequencerFX extends MachineComponent implements IRender.RandomDispl
if (!this.getUtil().getProcess().isInProgress()) {
return;
}
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1.2 + rand.nextDouble() * 0.2, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = this.posX;
double axisZ = this.posZ;
double angle = this.rand.nextDouble() * 2.0 * 3.1415;
{
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.0;
this.particleMaxAge = 200;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.6f + this.rand.nextFloat() * 0.2f, 1.0f, 0.8f * this.rand.nextFloat() * 0.2f);
}
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.03;
this.setPosition(this.axisX + 0.4 * Math.sin(this.angle), this.posY, this.axisZ + 0.4 * Math.cos(this.angle));
this.motionY = 0.0;
this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
});
Particle particle = new SequencerParticleRandomTick(world, pos, rand);
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(particle);
}
@SideOnly(Side.CLIENT)
@@ -62,37 +32,83 @@ public class SequencerFX extends MachineComponent implements IRender.RandomDispl
public void onDisplayTick(World world, BlockPos pos, Random rand) {
final int ticks = (int) (world.getTotalWorldTime() % 16L);
if (ticks == 0 && this.getUtil().getProcess().isInProgress()) {
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(new Particle(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0, 0.0, 0.0) {
double axisX = 0.0;
double axisZ = 0.0;
double angle = 0.0;
Particle particle = new SequencerParticle(world, pos);
BinnieCore.getBinnieProxy().getMinecraftInstance().effectRenderer.addEffect(particle);
}
}
{
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.012;
this.particleMaxAge = 50;
this.particleGravity = 0.0f;
this.canCollide = true;
this.particleScale = 2.0f;
//TODO: Add sprites
//this.setParticleIcon((new BinnieIcon[] { Sequencer.fxSeqA, Sequencer.fxSeqG, Sequencer.fxSeqC, Sequencer.fxSeqT })[this.rand.nextInt(4)].getIcon());
}
@SideOnly(Side.CLIENT)
private static class SequencerParticleRandomTick extends Particle {
double axisX;
double axisZ;
double angle;
@Override
public void onUpdate() {
super.onUpdate();
this.motionY = 0.012;
if (this.particleAge > 40) {
this.setAlphaF((50 - this.particleAge) / 10.0f);
}
}
public SequencerParticleRandomTick(World world, BlockPos pos, Random rand) {
super(world, pos.getX() + 0.5, pos.getY() + 1.2 + rand.nextDouble() * 0.2, pos.getZ() + 0.5, 0.0, 0.0, 0.0);
axisX = this.posX;
axisZ = this.posZ;
angle = this.rand.nextDouble() * 2.0 * 3.1415;
this.axisX = 0.0;
this.axisZ = 0.0;
this.angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.0;
this.particleMaxAge = 200;
this.particleGravity = 0.0f;
this.canCollide = true;
this.setRBGColorF(0.6f + this.rand.nextFloat() * 0.2f, 1.0f, 0.8f * this.rand.nextFloat() * 0.2f);
}
@Override
public int getFXLayer() {
return 1;
}
});
@Override
public void onUpdate() {
super.onUpdate();
this.angle += 0.03;
this.setPosition(this.axisX + 0.4 * Math.sin(this.angle), this.posY, this.axisZ + 0.4 * Math.cos(this.angle));
this.motionY = 0.0;
this.setAlphaF((float) Math.sin(3.14 * this.particleAge / this.particleMaxAge));
}
@Override
public int getFXLayer() {
return 0;
}
}
@SideOnly(Side.CLIENT)
private static class SequencerParticle extends Particle {
double axisX;
double axisZ;
double angle;
public SequencerParticle(World world, BlockPos pos) {
super(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0, 0.0, 0.0);
axisX = 0.0;
axisZ = 0.0;
angle = 0.0;
this.motionX = 0.0;
this.motionZ = 0.0;
this.motionY = 0.012;
this.particleMaxAge = 50;
this.particleGravity = 0.0f;
this.canCollide = true;
this.particleScale = 2.0f;
//TODO: Add sprites
//this.setParticleIcon((new BinnieIcon[] { Sequencer.fxSeqA, Sequencer.fxSeqG, Sequencer.fxSeqC, Sequencer.fxSeqT })[this.rand.nextInt(4)].getIcon());
}
@Override
public void onUpdate() {
super.onUpdate();
this.motionY = 0.012;
if (this.particleAge > 40) {
this.setAlphaF((50 - this.particleAge) / 10.0f);
}
}
@Override
public int getFXLayer() {
return 1;
}
}
}
@@ -4,7 +4,10 @@ import binnie.Constants;
import binnie.core.models.ModelManager;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ProxyClient extends Proxy implements IGeneticsProxy {
public static ModelManager modelManager = new ModelManager(Constants.GENETICS_MOD_ID);