Everything posted by Draco18s
-
[1.7.10] TileEntity getStackInSlot crash SOLVED
Oh geeze. https://github.com/Sudwood/AdvancedUtilities/blob/master/java/com/sudwood/advancedutilities/tileentity/TileEntityWoodenCrate.java#L48-L51 Don't do that. Just return 64.
-
[1.8] How to Create a Custom Liquid?
Declaration vs. Initialization vs. Assignment. Basic Java. Basic programming, really (although various languages will separate things a little farther, such as C* having separate declaration and definitions for functions).
-
[1.8] [SOLVED] Push floating drops
Your best bet might actually be to look at the hopper.
-
[1.8] How to Create a Custom Liquid?
mercury_block_static = new BlockFluidClassic(mercury_block_static Uh. You're passing the block you haven't yet created to the constructor of said block. At best you're passing null.
-
[1.7.10] Getting virtual chest inventory
I think he does want to examine the virtual-chest lookups from other mods. Short answer is: You won't be able to. Every one of those mods likely does things slightly differently, even if they all use IExtendedEntityProperties to store the data.
-
Access transformer help
Instead of instance.field you do fieldObj.set(instance, value) , (for static fields, you use null as the instance) but you have to do what I said above first or you'll get Access Denied exceptions.
-
[1.8] Mod is not recognized as a mod
I think your modID is too short. I have a vague recollection that it has to be at least 3 characters.
-
Access transformer help
GuiScreen.class.getField("field_146292_n").setAccessible(true)
-
[1.8] [SOLVED] Attempt to fix mergeItemstack isn't working
Not sure. That's what I use in my container class.
-
[1.8] [SOLVED] Attempt to fix mergeItemstack isn't working
I stole this from somewhere, I don't remember where. @Override protected boolean mergeItemStack(ItemStack itemstack, int i, int j, boolean flag) { // The default implementation in Slot doesn't take into account the Slot.isItemValid() and Slot.getSlotStackLimit() values. // So here is a modified implementation. I have only modified the parts with a comment. boolean flag1 = false; int k = i; if (flag) { k = j - 1; } if (itemstack.isStackable()) { while (itemstack.stackSize > 0 && (!flag && k < j || flag && k >= i)) { Slot slot = (Slot)inventorySlots.get(k); ItemStack itemstack1 = slot.getStack(); if (flag) { k--; } else { k++; } // Check if item is valid: if (!slot.isItemValid(itemstack)) { continue; } if (itemstack1 != null && itemstack1.getItem() == itemstack.getItem() && (!itemstack.getHasSubtypes() || itemstack.getItemDamage() == itemstack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(itemstack, itemstack1)) { //ItemStack.areItemStacksEqual(par0ItemStack, par1ItemStack) //ItemStack.areItemStackTagsEqual(par0ItemStack, par1ItemStack) int i1 = itemstack1.stackSize + itemstack.stackSize; // Don't put more items than the slot can take: int maxItemsInDest = Math.min(itemstack1.getMaxStackSize(), slot.getSlotStackLimit()); if (i1 <= maxItemsInDest) { itemstack.stackSize = 0; itemstack1.stackSize = i1; slot.onSlotChanged(); flag1 = true; } else if (itemstack1.stackSize < maxItemsInDest) { itemstack.stackSize -= maxItemsInDest - itemstack1.stackSize; itemstack1.stackSize = maxItemsInDest; slot.onSlotChanged(); flag1 = true; } } } } if (itemstack.stackSize > 0) { int l; if (flag) { l = j - 1; } else { l = i; } do { if ((flag || l >= j) && (!flag || l < i)) { break; } Slot slot1 = (Slot)inventorySlots.get(l); ItemStack itemstack2 = slot1.getStack(); if (flag) { l--; } else { l++; } // Check if item is valid: if (!slot1.isItemValid(itemstack)) { continue; } if (itemstack2 == null) { // Don't put more items than the slot can take: int nbItemsInDest = Math.min(itemstack.stackSize, slot1.getSlotStackLimit()); ItemStack itemStack1 = itemstack.copy(); itemstack.stackSize -= nbItemsInDest; itemStack1.stackSize = nbItemsInDest; slot1.putStack(itemStack1); slot1.onSlotChanged(); // itemstack.stackSize = 0; flag1 = true; break; } } while (true); } return flag1; }
-
Access transformer help
What are you doing wrong: 0) Using an access transformer. Reflection is much cleaner. -1) Not posting your crash log -2) Not posting your code
-
[1.7.10] [SOLVED] Custom Block Renderer Not Updating Block
Your description packet is null, so the client knows nothing about the server's TileEntity data.
-
[1.8] Mod is not recognized as a mod
You are missing your @instance annotation and field.
-
Making mobs move toward their block mob spawner
You need to understand how AI Task priority, Mutexbits, and CanBeInterrupted work together. Suffice to say, I need more code, like the whole tasks.addTask() list
-
"Enforce" the required level to break a Block and forbidding others?
No idea.
-
[1.8] [SOLVED] Hardness according to meta
Quite. Took them freaking ages to fix the "save/load causes fireballs to get frozen in midair" bug. As in, I reported it back in 1.6 and it got fixed in the last month. And they still haven't fixed the "slabs on top of ice" issue ("floor Ypos, then subtract 1" rather than "ceiling Ypos, then subtract 1").
-
[1.7.10] How to add new Celestial Bodies?
create a custom world provider *Cough*
-
Pickable crops
Only drop items on the server.
-
ASM retransform
Long story short: You're doing it wrong. Long version: What are you trying to transform and why?
-
"Enforce" the required level to break a Block and forbidding others?
That's not how that function works, actually. The reason it "acts" like 0.0 is because in a single tick you said that the player does "5.5 breaking strength worth of progress" towards breaking the block (once progress > hardness, the block breaks). To make the block act like it has 5.5 hardness, instead of its standard you'd have to do this: public float getPlayerRelativeBlockHardness(EntityPlayer player, World world, int x, int y, int z) { return 1 / 5.5f / 30; } For example, here's a block I have that I wanted to have a correct-tool for the hoe, but the hoe isn't a tool, so I had to figure out this math and series of calls on my own from other functions: public float getPlayerRelativeBlockHardness(EntityPlayer player, World world, int x, int y, int z) { //get the default breaking speed for this block //this is approximately (1 / hardness / 30) but there are other modifiers, such as being under water, jumping, and potions float f = ForgeHooks.blockStrength(this, player, world, x, y, z); ItemStack s = player.getCurrentEquippedItem(); //check for correct tool, this is required as the Hoe does not natively have a dig speed, thus not checked by ForgeHooks.blockStrength() if(s != null && s.getItem() instanceof ItemHoe) { //get the tool material and effetiveness manually because hoes aren't tools. ToolMaterial m = ToolMaterial.valueOf(((ItemHoe)s.getItem()).getToolMaterialName()); f += m.getEfficiencyOnProperMaterial(); //get enchantments int i = EnchantmentHelper.getEfficiencyModifier(player); if (i > 0 && s != null) { //enchantments have weird effects. This is accurate! float f1 = (float)(i * i + 1); boolean canHarvest = ForgeHooks.canToolHarvestBlock(this, 0, s); //if we can't actually harvest the block if (!canHarvest && f <= 1.0F) { f += f1 * 0.08F; } else { f += f1; } } //finally, take the speed value (f), divide by hardness, and divide again by 30. return f / this.blockHardness / 30; } return f; }
-
drawCore Probleme
1.7's tessellator is just a wrapper around GL calls. WorldRenderer might be 1.8's wrapper. I actually borrowed some of Minecraft's setup when doing some direct GL stuff in Unity3D. I have less access to GL in Unity than in Java, so I had to write a wrapper class (the tessellator) to translate from simple calls ("draw this texture at this point on the screen") into a series of GL calls (which had to be stored in an array to wait from UpdateTick until PostRender). Ended up with quite the class, letting me set shaders, do both 2D and 3D in any order, and so on.
-
[solved][1.7.10]custom mob not attacking other mobs
That's called an AI Task and there's already an AI Task for this, go look at EntityZombie
-
What's the problem with this code?
1.7.10 doesn't allow for transparent pixels. The png file gets thresholded (above a certain alpha -> 1, else -> 0). 1.8 looks like it'll allow for partial transparency in items, which is really cool.
-
[1.7.10] Spawning Particles when Hit Entity
Block break particles aren't called in the same way as other particles.
-
[1.8]iinventory howto prevent a player to move certain slot in inventory<Solved>
You never call setHabilitado() anywhere. There's also no god damn reason you need to override every single method of the slot or container classes. For example, here's a custom slot class I use: public class SlotIInventory extends Slot { public SlotIInventory(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) { super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_); } @Override public boolean isItemValid(ItemStack stack) { if(inventory.isItemValidForSlot(slotNumber, stack)) { ItemStack ss = stack.copy(); ss.stackSize = 1; inventory.setInventorySlotContents(slotNumber, ss); } return false; } @Override public boolean canTakeStack(EntityPlayer par1EntityPlayer) { inventory.setInventorySlotContents(slotNumber, null); return false; } } That's it. No isSlotInInventory , no decrStackSize , just the methods I actually NEED. Second: // Player Inventory, Slot 9-35, Slot IDs 9-35 for (int y = 0; y < 3; ++y) { for (int x = 0; x < 9; ++x) { this.addSlotToContainer(new mercenarySlot(playerInv, x + y * 9 + 9, 8 + x * 18, 84 + y * 18)); } } Why the fuck are you making the player's inventory slots your custom slot type? WHY? THIRD when you call cambiarA0, cambiarA7, or cambiarA23, you're adding the player's inventory slots again.
IPS spam blocked by CleanTalk.