KittenKoder
Members-
Posts
77 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
KittenKoder's Achievements
Stone Miner (3/8)
6
Reputation
-
I have searched for something up to date, and found nothing. All I am doing is trying to add a custom bow with a set of obj models. Everything works but the transforms are not showing as all. I have no control over the transforms, and when I look at the vanilla code the bow seems to have hard coded transformations. I know Tinker's Construct managed to make this work, but I can't figure out how they did it. Here's the blockstate I tried: { "forge_marker": 1, "defaults": { "textures": { }, "model": "magitech:bow_compound_model" }, "variants": { "normal": [{ }], "inventory": [{ "transform": { "gui": { "rotation": [ { "y": 0}, {"x": 0}, {"z": 0} ], "translation": [ 0, 0, 0], "scale": 2.0 }, "ground": { "rotation": [ { "y": 0}, {"x": 0}, {"z": 0} ], "translation": [ 0, 0.25, 0], "scale": 1.5 }, "thirdperson": { "rotation": [ { "y": 90}, {"x": 0}, {"z": 45} ], "translation": [ 0, 0.475, 0.15], "scale": 1.35 }, "firstperson": { "rotation": [ { "y": 90}, {"x": 0}, {"z": 45} ], "translation": [ 0, 0, 0 ], "scale": 5.0 }, "fixed": { "rotation": [ { "y": 0}, {"x": 0}, {"z": 90} ], "translation": [ 0, 0, 0 ], "scale": 0.9 } } }] } } And the file it references (not sure why but it only looks in the block models for it): { "model": "magitech:item/bow_compound_model_standby.obj", "textures": { }, "overrides": [ { "predicate": { "pulling": 0 }, "model": "magitech:item/bow_compound_model_standby.obj" }, { "predicate": { "pulling": 1 }, "model": "magitech:item/bow_compound_model__pulling_0.obj" }, { "predicate": { "pulling": 1, "pull": 0.65 }, "model": "magitech:item/bow_compound_model__pulling_1.obj" }, { "predicate": { "pulling": 1, "pull": 0.9 }, "model": "magitech:item/bow_compound_model__pulling_2.obj" } ] } The rest is pretty basic, I tried using the vanilla transforms like this: { "model": "magitech:bow_compound_model_standby.obj", "textures": { }, "display": { "thirdperson_righthand": { "rotation": [ 0, 0, 0 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "thirdperson_lefthand": { "rotation": [ 0, 0, 0 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "firstperson_righthand": { "rotation": [ 0, 0, 0 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 3.0, 3.0, 3.0 ] }, "firstperson_lefthand": { "rotation": [ 0, 0, 0 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] } }, "overrides": [ { "predicate": { "pulling": 0 }, "model": "magitech:item/bow_compound_model_standby.obj" }, { "predicate": { "pulling": 1 }, "model": "magitech:item/bow_compound_model__pulling_0.obj" }, { "predicate": { "pulling": 1, "pull": 0.65 }, "model": "magitech:item/bow_compound_model__pulling_1.obj" }, { "predicate": { "pulling": 1, "pull": 0.9 }, "model": "magitech:item/bow_compound_model__pulling_2.obj" } ] } But all of them produce the exact same results, the model is rotated as a simple held/generated item. So why and how do I fix it? It only happens with the that have an override property, nothing else has had this problem (I've added a lot of other items with obj models already). If I extend Item or ItemBow, it makes no difference.
-
[1.12.2] Using Registries crashes in ClientLauncher
KittenKoder replied to WOLFI3654's topic in Modder Support
There are many cases in which the JSON recipes are clunky, like for adding a bunch of recipes for simple variants of models (such as if you are adding in a bunch of stairs). While making your own recipe class seems to be preferred, it's just adding more work when a simple array list would cut the work in half or more. -
Okay, so here's the thing I've been trying to find: a way to render armor using an OBJ model. I have gotten as far as finding the IModel of the armor, but I can't find anything about rendering it and how to do that, at least nothing up to date. Most resources say to bake it every time, then render it and I know that's not a good idea. The inventory model is different from the worn model, if that means anything. So do I find the model using the baked model system? I think I know how to render it that way if so. Or do I need to use the IModel? If so, how do you render one of those? The entire rendering system here just seems like a mess and I am not that good with the old GL styles so I often get completely lost when those methods are employed. I mean the entire GLStateManager concept took some getting use to, I prefer matrices as they are much easier to manage. So some insight on this is really welcomed. I do have some TESRs that work, but this part doesn't seem to function like those at all.
-
[1.12.2] [SOLVED] Custom TileEntity Values Reset
KittenKoder replied to KittenKoder's topic in Modder Support
Okay, I made the same mistake I have made before but stupid me didn't think to double check that part of the code. Seeing as how this is the first time I was stupid enough to start a thread on this, here was the issue: I was looking at the wrong instance for Minecraft to get the tile entity in the data packet code. While the client was receiving the packet, and acting on it, it was getting the TE from the server world instead. Copy-pasta has some problems even when it's your own code. In case someone else finds this to be similar to their problem. Just make sure you look for the entity from the correct instance. Now I get to clean up my class. -
I don't think you understood. Replace the (IInventory) player with player.inventory
-
[1.12] BlockState rendering not working
KittenKoder replied to grand_gibus's topic in Modder Support
Your meta/state getters don't seem to include the HALF property, while your JSON depends on those values being set. Perhaps that is the cause? -
Between function calls, every value except the inventory is reset to their default values. The problem is that I cannot see where or why. The code is a mess as I have been trying to find a work around for this, but no system of notifying the client side of changes seems to keep the values, even the GUI set is reset to null. This doesn't seem right as I have accomplished the same thing in other custom TileEntity classes, using even more data. The question is why is this happening? Is there a clean way to correct this without having to create more classes? package com.kittenkoder.magitech.tile; import java.util.LinkedList; import java.util.UUID; import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.ItemStackHandler; import com.kittenkoder.magitech.Magitech; import com.kittenkoder.magitech.MagitechOreRegistry; import com.kittenkoder.magitech.blocks.IMagitechBlockVariant; import com.kittenkoder.magitech.blocks.MagitechBlockFan; import com.kittenkoder.magitech.blocks.MagitechBlockMachineCrusher; import com.kittenkoder.magitech.blocks.MagitechBlockMachineSmelter; import com.kittenkoder.magitech.gui.MagitechGUIMachine; import com.kittenkoder.magitech.network.MagitechIntegerRequestUpdate; import com.kittenkoder.magitech.network.MagitechUpdateFluid; import com.kittenkoder.magitech.network.MagitechUpdateIntegerPacketClient; import com.kittenkoder.magitech.network.MagitechUpdateRequestFluids; import com.kittenkoder.magitech.network.containers.UpdatePostData; import com.kittenkoder.magitech.util.MagitechFluidLevel; public class MagitechTileEntityMachineSmelter extends MagitechTileEntityBox implements IMagitechTileMachine, IMagitechTileEntityWatts, IMagitechBlockVariant, IMagitechTileInventory, IMagitechTileEntityIntegerUpdate, ITickable, IMagitechTileEntityFluid { protected final LinkedList<UpdatePostData> UPDATE_LIST; protected int _processtime = 0, _cooldown = 10; protected final MagitechFluidLevel _fluid_result; protected boolean _haspower = false; protected int _speed = 1, _capacity = 16; protected MagitechGUIMachine _gui; public MagitechTileEntityMachineSmelter() { super(1); this._fluid_result = new MagitechFluidLevel(MagitechOreRegistry.Fluids.ALUMINUM, 0); this.UPDATE_LIST = new LinkedList<UpdatePostData>(); this._gui = null; } public void setGUI(MagitechGUIMachine gui) { this._gui = gui; if(gui != null) Magitech.net.sendToServer(new MagitechUpdateRequestFluids(this)); } @Override public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) { return (oldState.getBlock() != newState.getBlock()); } public void setHasPower(boolean h, boolean update) { this._haspower = h; if(!this.getWorld().isRemote){ if(!h) { this._processtime = 0; this.setIntegerToUpdate(0, Flag.PROGRESS, null, true); } if(update) { IBlockState bl = this.getWorld().getBlockState(this.getPos()); if(bl != null && bl.getBlock() instanceof MagitechBlockMachineSmelter) { bl = bl.withProperty(MagitechBlockMachineSmelter.POWERED, this._haspower); this.getWorld().setBlockState(this.getPos(), bl); } this.markDirty(); } } } public int getProgress() { return this._processtime; } public boolean getHasPower() { return this._haspower; } @Override public void setIntegerToUpdate(int i, IMagitechTileEntityIntegerUpdate.Flag flag, UUID player, boolean s) { if(this.getWorld().isRemote) { if(!s) { this._processtime = i; } } else { if(s) { this.UPDATE_LIST.add(new UpdatePostData(this, this._processtime, Flag.PROGRESS, null)); Magitech.net.sendToAllAround(new MagitechUpdateIntegerPacketClient(this), new NetworkRegistry.TargetPoint(this.getWorld().provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 8)); } } } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound = super.writeToNBT(compound); compound.setInteger("MagitechProgress", this._processtime); compound.setInteger("MagitechSpeed", this._speed); compound.setInteger("MagitechCapacity", this._capacity); compound.setBoolean("MagitechPowered", this._haspower); this.writeFluidsToNBT(compound); return compound; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this._processtime = compound.getInteger("MagitechProgress"); this._speed = compound.getInteger("MagitechSpeed"); this._capacity = compound.getInteger("MagitechCapacity"); this._haspower = compound.getBoolean("MagitechPowered"); this.readFluidsFromNBT(compound); } @Override public int getNextUpdateInteger() { UpdatePostData n = this.UPDATE_LIST.getFirst(); return n.value; } @Override public IMagitechTileEntityIntegerUpdate.Flag getNextUpdateFlag() { UpdatePostData n = this.UPDATE_LIST.getFirst(); return n.flag; } @Override public void popNext() { this.UPDATE_LIST.remove(); } @Override public ItemStack getStackInSlot(int index) { return this.inventory.getStackInSlot(0); } @Override public ItemStack removeStackFromSlot(int index) { ItemStack stack = this.inventory.getStackInSlot(0); this.inventory.setStackInSlot(0, ItemStack.EMPTY); return stack; } @Override public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) { if(this.inventory == null) return super.hasCapability(capability, facing); return (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && facing == EnumFacing.UP) || super.hasCapability(capability, facing); } @SuppressWarnings("unchecked") @Nullable @Override public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) { if(this.inventory == null) return super.getCapability(capability, facing); if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { if(facing == EnumFacing.UP) return (T)this.inventory; } return super.getCapability(capability, facing); } @Override public void setInventorySlotContents(int index, ItemStack stack) { this.inventory.setStackInSlot(0, stack); } public void writeFluidsToNBT(NBTTagCompound compound) { NBTTagCompound fl = new NBTTagCompound(); fl.setInteger("FluidCount", 1); String na = "Fluid"; fl.setInteger(na + "Index", this._fluid_result._fluid.index); fl.setInteger(na + "Level", this._fluid_result._level); compound.setTag("MagitechFluid", fl); System.out.println("Level Writ: " + this._fluid_result._level); System.out.println("Fluid Writ: " + this._fluid_result._fluid.index); } public void readFluidsFromNBT(NBTTagCompound compound) { if(compound.hasKey("MagitechFluid")) { NBTTagCompound fl = compound.getCompoundTag("MagitechFluid"); String na = "Fluid"; this._fluid_result.set(MagitechOreRegistry.Fluids.find(fl.getInteger(na + "Index")), fl.getInteger(na + "Level")); System.out.println("Level Read: " + this._fluid_result._level); System.out.println("Fluid read: " + this._fluid_result._fluid.index); } } @Override public ItemStackHandler getInventory() { return this.inventory; } @Override public int getWattLevel() { return 0; } @Override public void setWattLevel(int p) { } @Override public void onLoad() { if(this.getWorld().isRemote) { Magitech.net.sendToServer(new MagitechIntegerRequestUpdate(this, Flag.PROGRESS)); Magitech.net.sendToServer(new MagitechUpdateRequestFluids(this)); return; } } @Override public boolean takesWatts(EnumFacing face, IBlockState state) { return face == state.getValue(MagitechBlockMachineCrusher.VARIANT).face; } @Override public boolean suppliesWatts(EnumFacing face, IBlockState state) { return false; } @Override public void notifyMachineStructure(BlockPos cpos, World nworld) { this._speed = 1; for(int y = -5; y < 6 && this._speed < 99; y++) { BlockPos tpos = cpos.add(0, y, 0); if(tpos.getY() < 256 && tpos.getY() > 0) { for(int x = -5; x < 6 && this._speed < 99; x++) { for(int z = -5; z < 6 && this._speed < 99; z++) { BlockPos npos = tpos.add(x, 0, z); IBlockState tile = nworld.getBlockState(npos); if(tile != null) { Block tblock = tile.getBlock(); if(tblock instanceof MagitechBlockFan) this._speed = Math.min(99, this._speed + ((MagitechBlockFan)tblock).getRank() + 1); } } } } } this.markDirty(); } @Override public void update() { if(this.getWorld().isRemote || !this._haspower) return; this._cooldown--; if(this._cooldown > 0) return; this._cooldown = 5; ItemStack stack = this.inventory.getStackInSlot(0); if(stack.isEmpty()) { int lastproc = this._processtime; this._processtime = 0; if(lastproc != 0) this.setIntegerToUpdate(0, Flag.PROGRESS, null, true); return; } MagitechFluidLevel presult = null; MagitechOreRegistry.Ore ore; int level = 1; if(!stack.isEmpty()) { Item item = stack.getItem(); ore = MagitechOreRegistry.byAllWithDust(item); if(ore == null && item instanceof ItemBlock) { Block block = ((ItemBlock)item).getBlock(); ore = MagitechOreRegistry.byOre(block); if(ore == null) { ore = MagitechOreRegistry.byBlock(block); if(ore != null) level = 9; } } if(ore != null) presult = new MagitechFluidLevel(MagitechOreRegistry.Fluids.getByOre(ore), level); } boolean isvalid = presult != null && (this._fluid_result._level == 0 || (this._fluid_result._fluid == presult._fluid && this._fluid_result._level + presult._level <= this._capacity)); if(!isvalid) { int lastproc = this._processtime; this._processtime = 0; if(lastproc != 0) this.setIntegerToUpdate(0, Flag.PROGRESS, null, true); this.markDirty(); return; } else { this._processtime += this._speed; if(this._processtime < 100) { this.setIntegerToUpdate(0, Flag.PROGRESS, null, true); return; } this._processtime = 0; this.setIntegerToUpdate(0, Flag.PROGRESS, null, true); this.inventory.extractItem(0, 1, false); if(this._fluid_result._fluid != presult._fluid) this._fluid_result.set(presult); else this._fluid_result._level += presult._level; this.markDirty(); Magitech.net.sendToAllAround(new MagitechUpdateFluid(this), new NetworkRegistry.TargetPoint(this.getWorld().provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 8)); } } @Override public UUID getNextPlayer() { return null; } @Override public String getUnlocalizedName(int meta) { return this.blockType.getLocalizedName(); } @Override public MagitechGUIMachine.Type getGUIType() { return MagitechGUIMachine.Type.SMELTER; } @Override public int getDataForInteger(Flag flag) { if(flag == Flag.PROGRESS) return this._processtime; return 0; } @Override public int getNumberOfFluids() { return 1; } @Override public LinkedList<MagitechFluidLevel> getFluidLevels() { if(this._fluid_result != null) { LinkedList<MagitechFluidLevel> list = new LinkedList<MagitechFluidLevel>(); list.add(this._fluid_result); return list; } return null; } @Override public void setFluidLevels(LinkedList<MagitechFluidLevel> f) { if(f != null && f.size() > 0) this._fluid_result.set(f.pop()); else this._fluid_result._level = 0; if(this._gui != null) this._gui.setFluid(this._fluid_result._fluid, this._fluid_result._level); System.out.println("Level Rec: " + this._fluid_result._level); System.out.println("Fluid Rec: " + this._fluid_result._fluid.index); System.out.println("To GUI: " + this._gui); } @Override public MagitechFluidLevel getFluid(int i){ return this._fluid_result; } }
-
Or use the <> code tag if it's short. Something that doesn't require downloading.
-
[1.12.2] unable to get textures/json to load
KittenKoder replied to mischief247's topic in Modder Support
Are your textures in the <projectroot>resources/assets/<modid>/textures directory? The compiler looks in the resources directory for the assets directory. The root directory is where you are running Gradle from most of the time. -
[1.12.2] unable to get textures/json to load
KittenKoder replied to mischief247's topic in Modder Support
It's better to use the code tags, just a recommendation. They are < > in the editor. -
[1.12.2][SOLVED] Issue with update() in tile entity
KittenKoder replied to uncleofbob's topic in Modder Support
This was the part I was interested in. But after reading your post again I think I understood and replaced everything with the get methods in my update method. I'm getting it to work with the classes now as well. If your's breaks again, try replacing the world member with the getWorld method too. Thanks for keeping on this, I had to write almost a hundred recipe files today so I haven't had time to dig more on it. lol It didn't occur to me to look at the members being referenced in the functions. -
[1.12.2][SOLVED] Issue with update() in tile entity
KittenKoder replied to uncleofbob's topic in Modder Support
I don't understand what you mean by this? I was testing with just System.out messages and got nothing in the logs (junk or server). Could you please show us the code involved? -
[1.12.2][SOLVED] Issue with update() in tile entity
KittenKoder replied to uncleofbob's topic in Modder Support
You can also access it with TileEntity::pos, so be careful using that as a variable in your TE. -
I have this button I extended from GuiButton because I couldn't get the regular texture button to work. Here's the class: package com.kittenkoder.magitech.gui; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class MagitechGUIButtonTexture extends GuiButton { protected ResourceLocation _texture; protected int _texx, _texy; public MagitechGUIButtonTexture(int buttonId, int x, int y, int widthIn, int heightIn, ResourceLocation texture, int tx, int ty) { super(buttonId, x, y, widthIn, heightIn, ""); this._texture = texture; this._texx = tx; this._texy = ty; } public void setTexCoords(int x, int y) { this._texx = x; this._texy = y; } public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { if(!this.visible) return; mc.getTextureManager().bindTexture(this._texture); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect(this.x, this.y, this._texx, this._texy, this.width, this.height); } } The problem is that it's drawing something odd to the right of the GUI, here's an image: It looks like it's drawing one of the texture coordinates there as when I change the buttons' contents (which only changes where it gets the texture piece from) the artifacts change. Did I forget to override something? The Gui and GuiButton source hasn't offered much clues into this. In case it's the GUI that the buttons are being added to, here's that: package com.kittenkoder.magitech.gui; import java.io.IOException; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.util.ResourceLocation; import com.kittenkoder.magitech.Magitech; import com.kittenkoder.magitech.tile.MagitechTileEntitySorter; import com.kittenkoder.magitech.util.MagitechUtils; public class MagitechGUISorter extends GuiContainer { private static final ResourceLocation BG_TEXTURE = new ResourceLocation(Magitech.MODID, "textures/gui/container/pipe_sorter.png"); // private static final String TEXT_INPUT = I18n.format("text.gui_sorter.input"); // private static final String TEXT_OUTPUT = I18n.format("text.gui_sorter.output"); private InventoryPlayer _player; private MagitechTileEntitySorter _sorter; public MagitechGUISorter(Container inventorySlotsIn, InventoryPlayer player, MagitechTileEntitySorter sorter) { super(inventorySlotsIn); this._sorter = sorter; this._player = player; this._sorter.setGUI(this); } public void initGui() { super.initGui(); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.buttonList.add(this.createButton(MagitechTileEntitySorter.Job.SORT_1, x, y)); this.buttonList.add(this.createButton(MagitechTileEntitySorter.Job.SORT_2, x, y)); this.buttonList.add(this.createButton(MagitechTileEntitySorter.Job.SORT_3, x, y)); this.buttonList.add(this.createButton(MagitechTileEntitySorter.Job.SORT_4, x, y)); this.buttonList.add(this.createButton(MagitechTileEntitySorter.Job.OUTPUT, x, y)); } protected MagitechGUIButtonTexture createButton(MagitechTileEntitySorter.Job job, int x, int y) { int sx = 0; int sy = 0; int dx = 0; int dy = 0; MagitechUtils.Facing face = this._sorter.getFacing(job); if(MagitechUtils.Facing.DOWN == face) sx = 16; else if(MagitechUtils.Facing.NORTH == face) sy = 16; else if(MagitechUtils.Facing.SOUTH == face) sy = 32; else if(MagitechUtils.Facing.WEST == face) { sx = 16; sy = 16; } else if(MagitechUtils.Facing.EAST == face) { sx = 16; sy = 32; } if(MagitechTileEntitySorter.Job.SORT_2 == job) dy = 36; else if(MagitechTileEntitySorter.Job.SORT_3 == job) dx = 36; else if(MagitechTileEntitySorter.Job.SORT_4 == job) { dx = 36; dy = 36; } else if(MagitechTileEntitySorter.Job.OUTPUT == job) { dx = 18; dy = 18; } MagitechGUIButtonTexture butt = new MagitechGUIButtonTexture(job._index, 62 + x + dx, 17 + y + dy, 16, 16, BG_TEXTURE, sx + 176, sy); return butt; } public void updateButton(MagitechTileEntitySorter.Job job, MagitechUtils.Facing face) { int i = job._index; for(GuiButton button : this.buttonList) { if(button.id == i) { MagitechGUIButtonTexture butt = (MagitechGUIButtonTexture)button; int sx = 0; int sy = 0; if(MagitechUtils.Facing.DOWN == face) sx = 16; else if(MagitechUtils.Facing.NORTH == face) sy = 16; else if(MagitechUtils.Facing.SOUTH == face) sy = 32; else if(MagitechUtils.Facing.WEST == face) { sx = 16; sy = 16; } else if(MagitechUtils.Facing.EAST == face) { sx = 16; sy = 32; } butt.setTexCoords(sx + 176, sy); return; } } } protected void updateButton(GuiButton button) { if(button instanceof MagitechGUIButtonTexture) { MagitechGUIButtonTexture butt = (MagitechGUIButtonTexture)button; int sx = 0; int sy = 0; MagitechUtils.Facing face = this._sorter.getFacing(button.id); if(MagitechUtils.Facing.DOWN == face) sx = 16; else if(MagitechUtils.Facing.NORTH == face) sy = 16; else if(MagitechUtils.Facing.SOUTH == face) sy = 32; else if(MagitechUtils.Facing.WEST == face) { sx = 16; sy = 16; } else if(MagitechUtils.Facing.EAST == face) { sx = 16; sy = 32; } butt.setTexCoords(sx + 176, sy); } } protected void actionPerformed(GuiButton button) throws IOException { int i = button.id; if(i > -1 && i < 5) { this._sorter.setIntegerToUpdate(i, 0, true); return; } super.actionPerformed(button); } protected void drawFace(MagitechTileEntitySorter.Job job, int x, int y) { int sx = 0; int sy = 0; int dx = 0; int dy = 0; MagitechUtils.Facing face = this._sorter.getFacing(job); if(MagitechUtils.Facing.DOWN == face) sx = 16; else if(MagitechUtils.Facing.NORTH == face) sy = 16; else if(MagitechUtils.Facing.SOUTH == face) sy = 32; else if(MagitechUtils.Facing.WEST == face) { sx = 16; sy = 16; } else if(MagitechUtils.Facing.EAST == face) { sx = 16; sy = 32; } if(MagitechTileEntitySorter.Job.SORT_2 == job) dy = 36; else if(MagitechTileEntitySorter.Job.SORT_3 == job) dx = 36; else if(MagitechTileEntitySorter.Job.SORT_4 == job) { dx = 36; dy = 36; } else if(MagitechTileEntitySorter.Job.OUTPUT == job) { dx = 18; dy = 18; } drawTexturedModalRect(dx + 62 + x, dy + 17 + y, sx + 176, sy, 16, 16); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1, 1, 1, 1); mc.getTextureManager().bindTexture(BG_TEXTURE); int x = (width - xSize) / 2; int y = (height - ySize) / 2; drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); super.drawScreen(mouseX, mouseY, partialTicks); this.renderHoveredToolTip(mouseX, mouseY); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { String name = I18n.format(this._sorter.getBlockType().getUnlocalizedName() + ".name"); this.fontRenderer.drawString(name, xSize / 2 - fontRenderer.getStringWidth(name) / 2, 6, 0x404040); this.fontRenderer.drawString(this._player.getDisplayName().getUnformattedText(), 8, ySize - 94, 0x404040); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawFace(MagitechTileEntitySorter.Job.SORT_1, x, y); this.drawFace(MagitechTileEntitySorter.Job.SORT_2, x, y); this.drawFace(MagitechTileEntitySorter.Job.SORT_3, x, y); this.drawFace(MagitechTileEntitySorter.Job.SORT_4, x, y); this.drawFace(MagitechTileEntitySorter.Job.OUTPUT, x, y); } protected void jobClicked(MagitechTileEntitySorter.Job job) { this._sorter.setJob(job, this._sorter.getFacing(job).getNext()); } protected void renderHoveredToolTip(int x, int y) { super.renderHoveredToolTip(x, y); } public void onGuiClosed() { this._sorter.setGUI(null); super.onGuiClosed(); } } On this, in insight would be helpful to get rid of it.
-
[1.12.2] (Server-Client Messaging) Need a second pair of eyes.
KittenKoder replied to KittenKoder's topic in Modder Support
... and yet again I feel like an ideeot! It had nothing to do with that class, it was the message processing class that was in error. It was looking at the wrong world instance, serves me right for using copy-pasta even when it is my own code. So for those running into similar issues, remember to get the correct world instances when collecting the TileEntity to modify in a message.