Jump to content

N247S

Forge Modder
  • Posts

    222
  • Joined

  • Last visited

Everything posted by N247S

  1. I'm not a fan of bumping, but is there anyone who could help me out here? Its just that I dont understand where the position difference is comming from between the FXLayers!
  2. Well, whats the exact problem? What happens/doesn't work? As for now it seems pretty organized to me.
  3. Oke, good to hear that there are no problems with the Slots anymore. About the world problem, the Container Class is used by the Server and the Client. I think thats why the WorldObj can be null. The solution would be to encapsle it with a SideCheck(!World.isremote). It has to check if its the server side, since thats the where the recipes are saved Honestly I dont know for sure if it will work, since I check this in the tileEntity along with some other stuff. But technically it should work.
  4. Are you talking about Vanilla textures, or your own textures? and about the Log part, there doesn't seems to be anything wrong about it. The error part is just that your player with the name "REDACTED", can't be found at the Majong authlib., or that the game doesn't have a connection.
  5. Hey, I have been struggling with this problem for a rather long time, and I can't get my hands on it. Bassicly I want to spawn in Particles, who needs to stay at their exact location (exact pixel 0.00 movement!). that would be rather easy right? setting this.motionX to 0! But sadly it aint that easy. there are 4 FXLayers for Particles. 0 - for regular Vanilla particles. 1 - for blockBreaking particles 2 - for effects like thunder, raindrops (not rain particles!) etc. 3 - basicly the rest (e.g. custom particles) For all FXLayers, except Layer 3, there is an texture bound to it, and the tess. codes are already made for you. But for FXLayer 3, you need to do a lot of the rendering yourself. No problems here! The srange part is that the particles on FXLayer 3 don't stay at their exact location, but they move around when the player moves as well! Also they can't collide with walls(unlike an FXLayer 0 particle) when I use the same methods on FXLayer 0, it doesn't move. But since the texture is already bound, your texture will either override, or blend with the vanilla particles on FXLayer 0! so for example, when it rains. there will be bright quads in the place of the usual rain particles! So my question is, how can I make the Particle dont move with the player on FXLayer 3(Since binding to an other FXLayer will cause trouble!)? Thanks in advanced! N247S current codes package mechanical_crafting_table.client.particles.entityfx; import static org.lwjgl.opengl.GL11.*; import mechanical_crafting_table.Main; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.ForgeHooksClient; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class EntityWellFlashFX extends EntityFX { private static final ResourceLocation WellingFXTexture = new ResourceLocation(Main.MODID, "textures/particles/WellingFlash.png"); public EntityWellFlashFX(World world, double x, double y, double z) { super(world, x, y, z); this.particleScale = 5.0F; this.particleMaxAge = 2; this.particleGravity = 1F; this.particleAlpha = 1/255F; this.noClip = false; } @Override public void renderParticle(Tessellator tess, float particleTicks, float x, float y, float z, float u, float v) { if(this.particleAge < this.particleMaxAge) { Minecraft.getMinecraft().renderEngine.bindTexture(WellingFXTexture); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); tess.startDrawingQuads(); float f10 = 0.1F * this.particleScale; float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * particleTicks - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * particleTicks - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * particleTicks - interpPosZ); tess.setBrightness(getBrightnessForRender(1)); tess.addVertexWithUV((double)(f11 - x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 - z * f10 - v * f10), 0, 0); tess.addVertexWithUV((double)(f11 - x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 - z * f10 + v * f10), 0, 1); tess.addVertexWithUV((double)(f11 + x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 + z * f10 + v * f10), 1, 1); tess.addVertexWithUV((double)(f11 + x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 + z * f10 - v * f10), 1, 0); tess.draw(); glDisable(GL_BLEND); } } public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; if (this.particleAge++ >= this.particleMaxAge) { this.setDead(); } if (this.particleAge > this.particleMaxAge) { this.setAlphaF(this.particleAlpha / 2); } this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.0D; this.motionY *= 0.0D; this.motionZ *= 0.0D; } public int getBrightnessForRender(float brightnessFR) { return 15728880/2; } public float getBrightness(float brightness) { return 1.0F; } public int getFXLayer() { return 3; } }
  6. I didnt get it fully, but basically if you are using custom Slots you need to add regular slots for the Player Inv. (with ID's starting from 0!) and use your own slots for the Contianer (with ID's starting from 0 as wel!). for an exapmle see my ContainerClass. One thing I mentioned earlier was moving the Player inv. SlotID's upwards. NEVER DO THAT! that was a huge misstake from me! since there is only a limited ID range for the Player inv. therefore its higly recommended to either use Custom CraftingSlots, or the Vanilla variants. To clarify some things, your TileEntity doesn't store any Slot whatsoever! Basically it holds on to an array of Itemstacks. the confusion starts cause some methods are using the word Slot (for example getStackInSlot()). if you noticed, all the methods around the ItemStacks are only calling from the array, and no Slots are involved. Therefore you need to remeber one thing. The TileEntity only saves data from the TileEntity! e.g. itemStacks from the player, are from the Player, so don't save that in a tileEntity ever! The container Class is a helper Class for communication between Client and Server. values are stored on the server, but are rendererd on the Client side. The container itself can't store any data, though its enough for single use only (e.g. vanilla crafting table) but since you want to store data, you need the TileEntity as well So the Container Class creates the Slots, but don't know the content, and it gets it from the TileEntity. thats why start asigning ID's from 0 for your custom Contianer may become in handy (since the index of the Slots are equal to the index of the Array that way!). To sum up the changes I would recommend to apply: - Create your own SlotType. - Creat the Container Inv. from the CustomSlots and regular slots(for player inv. Only) - Changing the value of the ItemStack array inside the TileEntity to 26 (instead of 61) - Changing the methods Calling for any ID above 26 (cause the ID offset!) I think it would solve a lot of problems. ps. when using custom Slots, the parm. EntityPlayer can be left out, and replaced with tileEntity
  7. It should be (36+i)+(j*5). . But apart from that I realy would recommend swaping out the ID's of your tileEntity and the players inv. So your slots would be ranging from 0-25. Its way easier to link the tileEntity itemstacks to the container slots. Also right now you have all the itemstacks(including the player inv.) Saved inside the tileEntity, and what would happen on a server in that the case? Apart from that, if I want to know how many slots your tileEntity has, it will return 61 instead of 26. Also there is a method Clear(), what would happen if I call that one? I think its better to leave out the player inv. Slots/itemstacks. Inside the container class you are doing a lot of crazy things in the method slotClick(). I would recommend rewriting that method, since most bugs appear when you click on a slot(including player inv. Slots cause see above)
  8. Ok, so I dont know if you've updated you've updated your code yet but this line will cause trouble when adding ID's this.addSlotToContainer(new Slot(this.craftMatrix, i+j*36, 8+i*18, 7+j*18)); youre using a nested for-loop to asign 5 slots to each row (5 rows total). But this way row 0 starts at id 0.(hey, first 5 slots!) Second row starts on 36, third row starts on 72 etc.... this is what I ment with id conflicts!, easier work around is adding these slots first so no offset is needed. Or do it like this (i+j*5)+36.
  9. It gives an array out of bounds exception. And 35 means the first slot after the player inv.. Currently Im not able to check my codes unfortunatly, but I think youll need to add the player inv. After your inv.. that means that the player inv. Id are moving up. Since you want to add a 4x4 crafting system, why dont you take a look at this? (part of my 4x4 craftingSystem) package mechanical_crafting_table.common.inventory.container; import mechanical_crafting_table.common.inventory.slot.SlotCrafting; import mechanical_crafting_table.common.inventory.slot.SlotOutPut; import mechanical_crafting_table.common.inventory.slot.SlotDisplay; import mechanical_crafting_table.common.tileentity.MechanicalCraftingTableTileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ContainerMechanicalCraftingTable extends Container { private MechanicalCraftingTableTileEntity tileEntity; public int lastCraftTime; public int lastEnergyLevel; public int lastGasLevel; public static SlotDisplay output; public static final int craftmatrixHeigth = 4; public static final int craftmatrixWidth = 4; private int posX; private int posY; private int posZ; public ContainerMechanicalCraftingTable(InventoryPlayer inventory, MechanicalCraftingTableTileEntity tileentity) { SlotDisplay output = new SlotDisplay(inventory.player, tileentity, tileentity, 16, 127, 15); this.output = output; this.tileEntity = tileentity; this.addSlotToContainer(new SlotOutPut(tileentity, 17, 127, 66)); this.addSlotToContainer(output); for(int i = 0; i < craftmatrixHeigth; ++i) { for(int l = 0; l < craftmatrixWidth; ++l) { this.addSlotToContainer(new SlotCrafting(tileentity, l + i * 4, 30 + l * 18, 15 + i * 18 )); } } for (int i = 0; i < 3; ++i) { for (int l = 0; l < 9; ++l) { this.addSlotToContainer(new Slot(inventory, l + i * 9 + 9, 15 + l * 18, 97 + i * 18)); } } for(int i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(inventory, i, 15 + i * 18, 155)); } this.tileEntity.openInventory(); this.detectAndSendChanges(); } @Override public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); this.tileEntity.closeInventory(); } @Override public boolean canInteractWith(EntityPlayer player) { return this.tileEntity.isUseableByPlayer(player); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) { ItemStack i = null; Slot l = (Slot)this.inventorySlots.get(slotIndex); if (l != null && l.getHasStack()) { ItemStack il = l.getStack(); i = il.copy(); if (slotIndex == 0) { if (!this.mergeItemStack(il, 18, 54, true)) { return null; } l.onSlotChange(il, i); } else if (slotIndex >= 18 && slotIndex < 45) { if (!this.mergeItemStack(il, 45, 54, false)) { return null; } } else if (slotIndex >= 45 && slotIndex < 54) { if (!this.mergeItemStack(il, 18, 45, false)) { return null; } } else if (!this.mergeItemStack(il, 18, 54, false)) { return null; } if (il.stackSize == 0) { l.putStack((ItemStack)null); } else { l.onSlotChanged(); } if (il.stackSize == i.stackSize) { return null; } l.onPickupFromSlot(player, il); } return i; } @Override public void detectAndSendChanges() { super.detectAndSendChanges(); for (int i = 0; i < this.inventorySlots.size(); ++i) { ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) { itemstack1 = itemstack == null ? null : itemstack.copy(); this.inventoryItemStacks.set(i, itemstack1); for (int j = 0; j < this.crafters.size(); ++j) { ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); } } } for (int i = 0; i < this.crafters.size(); ++i) { ICrafting icrafting = (ICrafting)this.crafters.get(i); if (this.lastCraftTime != this.tileEntity.craftTime) { icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.craftTime); } if (this.lastEnergyLevel != this.tileEntity.energyLevel || this.tileEntity.energyIsChanged) { icrafting.sendProgressBarUpdate(this, 1, (int) this.tileEntity.energyLevel); this.tileEntity.energyIsChanged = false; } if(this.lastGasLevel != this.tileEntity.gasLevel || this.tileEntity.gasIsChanged) { icrafting.sendProgressBarUpdate(this, 2, (int)this.tileEntity.gasLevel); this.tileEntity.gasIsChanged = false; } this.lastEnergyLevel = (int) this.tileEntity.getEnergy(); this.lastCraftTime = this.tileEntity.craftTime; this.lastGasLevel = (int) this.tileEntity.getGas(); } } @Override public void addCraftingToCrafters(ICrafting crafter) { super.addCraftingToCrafters(crafter); crafter.sendProgressBarUpdate(this, 0, this.tileEntity.craftTime); crafter.sendProgressBarUpdate(this, 1, (int) this.tileEntity.energyLevel); crafter.sendProgressBarUpdate(this, 2, (int) this.tileEntity.gasLevel); } @SideOnly(Side.CLIENT) @Override public void updateProgressBar(int id, int var) { if (id == 0) { this.tileEntity.craftTime = (short) var; } if (id == 1) { this.tileEntity.energyLevel = var; } if(id == 2) { this.tileEntity.gasLevel = var; } } }
  10. Hey, your proxy is kinda messy. For example there are a lot of methods, but I dont see where thy should be called from. I would recommend to organize the class since I dont think jebelar ment this with puting the methods in the ClientProxy Anyway, inside the eventHandler you are spawning in the particles? I dont see any SideCheck around the method (e.g. event.world.isRemote). Maybe add this and see if its working? N247S
  11. Hey, a lot of bugs are linked together, so Ill split them up into 2 problems. 1- your slot ID matches the slot IDs from the player inventory. (1-5), if you would asign different ids for every slot, 4 bugs would be solved 2- for saving data(itemStacks) inside a tileEntity, youll need to write it to its nbt data and save it by marking the tileEntity(this.markDirty()) Overall there are some other things which are rather strange, for example the itemStack array of the TileEntity. Why should it have 61 inputs? But thats for later concern Anyway, I hope this will help you in the right direction. N247S
  12. I think the best way would be using the onEntityUpdate event or OnPlayerTickEvent. In these events you can set an entity(player)'s yaw,pitch, posistion, movements etc.. It won't be as easy as making an Entity wander since you can't use actions. So you have to define the path which the player should walk manually.
  13. Could you post your proxy Classes please?, also your main Class might be interesting to look at.
  14. What do you expect otherwise? It says "Ticking Entity" , usually that ocurs when an entity failed to updated somehow. Otherwise, how would you explain why a (vanilla!) Sheep caused a crash earlier? If its realy a NPE, it should point always to your mod right? Anyway, try what jabelar has pointed out.
  15. On which side do you spawn the particles?(I can't find it in the ArmorHandlerClass) Cause if you spawn them on the ServerSide (a lot of them) your game would crash (or has huge lag). I don't know why people keep saying that particles should be spawned on the ServerSide.(following several tutorials) Since particles should always be spawned in from the ClientSide! Anyway, I hope this helps, N247S
  16. You can use models and ResourceLocations as Fields as wel. That way you can easly switch between different textures/models.
  17. Yea, it was hard to make it flaweless indeed, but you can still use the idea. I got an example for an way to make the animation smooth: https://github.com/N247S/mechanical_crafting_table/blob/master/src/main/java/mechanical_crafting_table/client/render/MechanicalCraftingTableRenderer.java Basicly I set points of movements(like in MCAnimator) and than I calc the movement which is needed in every tick and set it every Tick. (It might be a bit hard to read)
  18. It should be seperatly downloadable indeed.
  19. Actualy, I dont know for sure if you need an obfuscated version as wel. (if all refference are oke, why is an obf lib. needed?) Anyway, if you need an example, just take a look at any API. You'll see what setup is mentioned by Ernio
  20. Nope, if you would try it out, youll see that in call hiearchy that all static methods(and fields) are linked together. that way its automatically synced. (Usually thats the purpose of an api, to save the time of syncing etc.)
  21. You can use an api for that indeed. I would recommend placing the (static)Hasmap inside the api along with the helper classes. this way a registery of items/recipdles will stay inside the api(wich doesnt require complicated intermod communication). But it can still be accessed through the same api, by every mod which has implemented the api(like your mod of course!)
  22. You can use an api for that indeed. I would recommend placing the (static)Hasmap inside the api along with the helper classes. this way a registery of items/recipdles will stay inside the api(wich doesnt require complicated intermod communication). But it can still be accessed through the same api, by every mod which has implemented the api(like your mod of course!)
  23. Did you set an username? Cause both instances need an different username. It worked fine for me btw, so honestly I dont know any otber reason why this shouldnt work.
  24. I do recommend it indeed, because it supports childmodelParts. But keep in mind that it aint perfect. I experianced an slight offset in the dimensions. but it shouldnt be disturbing if you don't need a model to be moving punctual at the single degree. (I only discoveres it cause I wanted a model to move exactualy across certain lines) If you need an example, I made an animated tileEntity in my mechanicalCraftingTable mod.(Link below) Feel free to take a look at it. Keep in mind though, my mod and the tutorial is for mc 1.7.10! So you probably need to dig into the .jons files etc. But apart from that, it should look similar. Anyway good luck, and please share the results! Im curious.
  25. Hey, I was strugling too with most programs like MCAnimator etc.. I don't know blender, you should try it to see if its working or not. But the Link that helped me out (for Entities at least) is this: http://jabelarminecraft.blogspot.nl/p/complex-entity-models-including.html He explains some neat tips and tricks on how to create your own animatons.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.