Abastro
Forge Modder-
Posts
1075 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Abastro
-
[1.8] [SOLVED] When running test client, it 'locks' up
Abastro replied to saxon564's topic in Modder Support
What method did it actually looping? It could help resolve this issue. -
[1.7.10] Trouble setting an NBTTag in an item
Abastro replied to HappyKiller1O1's topic in Modder Support
.. Just check with ItemStack#hasTagCompound to check if tag compound is exist, If it does not exist(! ItemStack.hasTagCompound()) just use ItemStack#setTagCompound(new NBTTagCompound()) to create itemstack nbttag. -
[1.7.10]GUI drawTexturedModalRect() bug or not working
Abastro replied to Enginecrafter's topic in Modder Support
GuiScreen#drawTexturedModalRect uses fixed rate for uv vs xy, so it wouldn't be useful as you think. Instead, make your own method replacing that; Usually setting uv to 0~1 is appropriate. -
Metadata system is changed to blockstates. So to compare block: World#getBlockState(x, y, z).getBlock() == (Block instance) To compare BlockState(block & metadata): World#getBlockState(x, y, z) == (BlockState instance) Also you can get default state from getDefaultState();
-
[1.7.10] Trouble setting an NBTTag in an item
Abastro replied to HappyKiller1O1's topic in Modder Support
cmp.setTag(VICTIMBASE, cmp); is making infinite loop to the structure... Fix the problem. -
[1.7.10] [UNSOLVED] Problems with rendering item inside an Item???
Abastro replied to Elix_x's topic in Modder Support
Pls post your current relevant code -
M_ModelRenderer.mRs should be null. Move following code in M_ModelRenderer's constructor to the static{}: mRs = new HashMap<ModelBase, ModelRenderer>(); ArrayList<ModelBase> mBs = new ArrayList<ModelBase>(); mBs.add(new ModelDwarfFemale()); mBs.add(new ModelDwarfMale()); mBs.add(new ModelElfFemale()); mBs.add(new ModelElfMale()); mBs.add(new ModelOrkFemale()); mBs.add(new ModelOrkMale());
-
Let the controller check nearby blocks, and when they meet certain condition, construct the multiblock. + What features do you want to give to the multiblock?
-
[1.7.10]Container error in transferStack()
Abastro replied to Enginecrafter's topic in Modder Support
Sure, I'll explain the code to you, line by line. @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot)inventorySlots.get(slot); //get the shift-clicked slot. if (slotObject != null && slotObject.getHasStack()) //If the slot is valid and has ItemStack { ItemStack stackInSlot = slotObject.getStack(); //Get the Stack on the slot. stack = stackInSlot.copy(); //Copy stack. if(slot < 9) //If the slot is on hotbar { if (!this.mergeItemStack(stackInSlot, 9, 44, true)) //Try merging the stack to the rest of the slot. { System.out.println("There are " + stackInSlot.stackSize + " of " + stackInSlot.getItem().getUnlocalizedName()); //The print statement when it is not able to merge the stack. return null; // Drop nothing. } } else { if(!this.mergeItemStack(stackInSlot, 0, 9, false)) { System.out.println("There are " + stackInSlot.stackSize + " of " + stackInSlot.getItem().getUnlocalizedName()); //The print statement when it is not able to merge the stack. return null; // Drop nothing. } } //When it is successfully merged, if (stackInSlot.stackSize == 0) //If the slot stack size is 0 { slotObject.putStack(null); //Set the stack to null. } else //Yes, da else { slotObject.onSlotChanged(); // Mark the slot as changed. } if (stackInSlot.stackSize == stack.stackSize) //When Slot stacksize is same, (So every stack has merged) { return null; // Drop Nothing. } slotObject.onPickupFromSlot(player, stackInSlot); // Let the slot to pick up rest of the stack // (which is not merged). } return stack; //IDK, it just returns null; So it drops nothing when no slot is found. } -
[Solved]Text repeated over and over in hotbar 1.6.4 mod
Abastro replied to Glistre's topic in Modder Support
Yes, override the method in your custom Item class. And the onUpdate method you used is bad for pre-enchanting purpose. -
Do you want to specify the entity type? Or the specific entity? For former, just save the entity id. For latter, just save the UUID of the entity.
-
... I don't know why those issues can ever happen, from this code.. (Note that mine is 1.7.10.1160 so it can be different) /** * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. */ public boolean unloadQueuedChunks() { if (!this.worldObj.levelSaving) { for (ChunkCoordIntPair forced : this.worldObj.getPersistentChunks().keySet()) { this.chunksToUnload.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); } for (int i = 0; i < 100; ++i) { if (!this.chunksToUnload.isEmpty()) { Long olong = (Long)this.chunksToUnload.iterator().next(); Chunk chunk = (Chunk)this.loadedChunkHashMap.getValueByKey(olong.longValue()); if (chunk != null) { chunk.onChunkUnload(); this.safeSaveChunk(chunk); this.safeSaveExtraChunkData(chunk); this.loadedChunks.remove(chunk); ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); if(loadedChunks.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId)){ DimensionManager.unloadWorld(this.worldObj.provider.dimensionId); return currentChunkProvider.unloadQueuedChunks(); } } this.chunksToUnload.remove(olong); this.loadedChunkHashMap.remove(olong.longValue()); } } if (this.currentChunkLoader != null) { this.currentChunkLoader.chunkTick(); } } return this.currentChunkProvider.unloadQueuedChunks(); } So it surely unloads the chunk before it saves the chunk data.. (Chunk#onChunkUnload surely marks the chunk as unloaded) The only another way the ChunkSave event got called is WorldServer#saveAllChunks(), which is only called when world is saved..
-
[1.7.10] Adding a scrolling gui containing the names of players?
Abastro replied to HappyKiller1O1's topic in Modder Support
What do you mean by ' there's no variable that I can change that allows me to bring in the left side'? Please post your code, too. -
[1.7.10] Adding a scrolling gui containing the names of players?
Abastro replied to HappyKiller1O1's topic in Modder Support
I just thought that anonimous class is bad structure, since the codecould be long. By now, I realized that it is short enough to use anonimous class. -
+ I'd say this again:
-
Move your model registration code to ClientProxy. They will crash on the Dedicated Server, since Minecraft class does not exist on that side.
-
[1.7.10]Container error in transferStack()
Abastro replied to Enginecrafter's topic in Modder Support
I assume that you are modifying the container of player. Then, What is this? Why 0~35? this.mergeItemStack(stackInSlot, 0, 35, true); It seems that it should be 9~44. -
It is replacement of metadata in 1.8; So Block#getBlockState() just gives base state of the block, which is fairly wrong. So you should use World#getBlockState(BlockPos). And for coal ore, comparing block instance is just fine. Don't compare IBlockState and Block, they are completely different object.
-
[1.7.10] Adding a scrolling gui containing the names of players?
Abastro replied to HappyKiller1O1's topic in Modder Support
I think you should get it but.. GuiScrollingList#elementClicked called when certain element is clicked, so you should set the selected index there. (You should declare the selected variable in the class.) And, it does not overlay the whole screen. As you can see, some of the parameters of the constructor indicates the size of the list. + Are you defining the list class as anonymous class? Don't do that; -
What... You cannot ever get to the World object during preInit/Init/postInit, because they just does not exist! And night is not 1200, but 12000. So, subscribe to the WorldEvent.Load, and change the time there. + You'd better increasing tick till it is not day(!World#isDayTime()) because there are mods which changes length of day.
-
No. Even forge would not be required. (theoretically)
-
Yes, /** * Queries the percentage of the 'Durability' bar that should be drawn. * * @param stack The current ItemStack * @return 1.0 for 100% 0 for 0% */ public double getDurabilityForDisplay(ItemStack stack) { return (double)stack.getItemDamageForDisplay() / (double)stack.getMaxDamage(); } (default implementation of stack.getItemDamageForDisplay() just gives stack.itemDamage) So this means that the javadoc is inverted. And how it is used: int j1 = (int)Math.round(13.0D - health * 13.0D); int k = (int)Math.round(255.0D - health * 255.0D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); Tessellator tessellator = Tessellator.instance; int l = 255 - k << 16 | k << 8; int i1 = (255 - k) / 4 << 16 | 16128; this.renderQuad(tessellator, p_94148_4_ + 2, p_94148_5_ + 13, 13, 2, 0); this.renderQuad(tessellator, p_94148_4_ + 2, p_94148_5_ + 13, 12, 1, i1); this.renderQuad(tessellator, p_94148_4_ + 2, p_94148_5_ + 13, j1, 1, l); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
-
It could be documented wrong.
-
There is a class called HoverChecker for checking if mouse is hovering an area. You can create it using a GuiButton, and in the method 'drawScreen' check for hovering using the class, and draw the tooltip there using the method: GuiScreen#func_146283_a(List strings, int x, int y).
-
[1.7.10] Problem with Built Mod NoDefClassFoundError
Abastro replied to grand_mind1's topic in Modder Support
Don't call or create anything related with TileEntityPoweredAnvil, when it is not needed. You can make separate class managing mod compatibility, like proxy class.