Jump to content

Silly511

Members
  • Posts

    176
  • Joined

Everything posted by Silly511

  1. I just figured out that I need to use IEnergyReceiver instead of IEnergyHandler.
  2. I did, but they said it was an error in my code. Here's exactly what he said: https://github.com/CoFH/Feedback/issues/1090#event-570397282
  3. I have a energy storage block that stores energy from a custom energy api I made and I want to make my energy api compatible with the RF api. But the problem I'm running into is that thermal dynamics energy pipes are not returning how much energy they received, so if I connect a generator from my mod up to a energy cell using thermal dynamics cable, the energy cell starts getting power but energy is not extracted from the generator so the generators power buffer fills up. However power is transmitted fine if the generator is right next to the energy cell, so it only does this with pipes. Here is the code I use to extract power from the generators buffer and place it in the blocks beside it: int i = 0; for (PositionInWorld pos : WorldHelper.getListOfPositionsAroundBlock(xCoord, yCoord, zCoord)) { TileEntity tile = worldObj.getTileEntity(pos.getX(), pos.getY(), pos.getZ()); if (tile instanceof IAuraUser) { this.extractAura(((BaseEnergyStorageBlock)tile).receiveAura(this.getStoredAura(), false), false); } else if (tile instanceof IEnergyHandler) { this.extractAura(((IEnergyHandler)tile).receiveEnergy(ForgeDirection.getOrientation(i).getOpposite(), (int) this.extractAura(this.getMaxStoredAura(), true), false), false); } i++; } Am I doing something wrong, or is this a bug and I should talk to the thermal dynamics devs about it?
  4. I've made a model in blender and exported to a .obj file. The model works fine, but the problem is how do I make a texture for this model? I know how to bind a texture and stuff, all I need to do is make the texture.
  5. I got it to work by adding GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(true); bindTexture(modelTexture); model.renderAll(); GL11.glPopAttrib(); to my code.
  6. I have made a blender model and have exported it to a .obj file and blinded it to a tile entity. But it does not render correctly, it's suppose to be a cylinder, but the ends are really weird. One side looks fine: But the other side looks really weird: Here is my .obj file: And my renderer class:
  7. I am using packets. It does sync. First it shows the correct value, then it turns to zero, then it starts counting up and works fine after that. It's the initial transfer that does not work, but after that it works fine.
  8. I have Waila integration for my energy system. When I place the storage block down, it says it has the correct amount of energy, but then it jumps to zero.
  9. Everything now only runs on the server side, the problem is still there.
  10. Then why is this happening? Here is my code: Main tile entity: package net.sparklepopprograms.enchantedaura.tileentitys; import net.minecraft.tileentity.TileEntity; import net.sparklepopprograms.core.api.energy.BaseEnergyStorageBlock; import net.sparklepopprograms.core.api.energy.IAuraUser; import net.sparklepopprograms.core.util.PositionInWorld; import net.sparklepopprograms.core.util.WorldHelper; public class TileAuraBuffer extends BaseEnergyStorageBlock { public TileAuraBuffer() { super(); this.setCapacity(35000); } @Override public void updateEntity() { PositionInWorld[] output = WorldHelper.getListOfPositionsAroundBlock(xCoord, yCoord, zCoord); int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); TileEntity tile = worldObj.getTileEntity(output[meta].getX(), output[meta].getY(), output[meta].getZ()); if (tile instanceof IAuraUser) { this.extractAura(((BaseEnergyStorageBlock)tile).receiveAura(this.getStoredAura(), false), false); } } } BaseEnergyStorageBlock: package net.sparklepopprograms.core.api.energy; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class BaseEnergyStorageBlock extends TileEntity implements IAuraUser { long energy; long capacity; public void readFromNBT(NBTTagCompound var1) { super.readFromNBT(var1); energy = var1.getLong("AuraStorage"); } public void writeToNBT(NBTTagCompound var1) { super.writeToNBT(var1); var1.setLong("AuraStorage", energy); } public void setCapacity(long capacity) { this.capacity = capacity; if (energy > capacity) { energy = capacity; } } public long receiveAura(long maxReceive, boolean simulate) { long energyReceived = Math.min(capacity - energy, maxReceive); if (!simulate) { energy += energyReceived; } return energyReceived; } public long extractAura(long maxExtract, boolean simulate) { long energyExtracted = Math.min(energy, maxExtract); if (!simulate) { energy -= energyExtracted; } return energyExtracted; } public void modifyEnergyStored(int energy) { this.energy += energy; if (this.energy > capacity) { this.energy = capacity; } else if (this.energy < 0) { this.energy = 0; } } public long getStoredAura() { return energy; } public long getMaxStoredAura() { return capacity; } @Override public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 3, nbttagcompound); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { this.readFromNBT(pkt.func_148857_g()); } }
  11. I have a tile entity that stores energy from a custom energy system I made, but the problem is that when I place down the energy storage block next to another energy storage block, the other energy storage block outputs all of its energy to the one I just placed down. Thats what it is supposed to do, and it does that but the problem is that it outputs all of its energy to the energy storage block I just placed down, before the tile entity initializes, so it outputs the power then that power gets deleted because it reads the nbt data first then writes it. So basically when ever I place a energy storage block next to another one, all the power in the first gets deleted. So, how do I stop a tile entity from reading nbt data when you first place the block?
  12. I have tried searching for this but all I got was using this MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3; to find the way the player is looking and then set the meta data based on that. The problem is that that code will tell you if the player is looking north, east, south, or west, but not up or down. What code should I use to see which way the player is looking, but includes up and down?
×
×
  • Create New...

Important Information

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