Jump to content

Elix_x

Members
  • Posts

    878
  • Joined

  • Last visited

Everything posted by Elix_x

  1. Now to model rendering: Wait, no, you're destroying 25 fps!!!! Correct this right now!!! Make resource locations - fields in class and define them in constructor, like that, no need to reload them 120 times / second... ( i mean that each time you do new resourceLocation, it loads it from drive) Do same thing with model... Now to model: Do you think that creating new model loader will render it? no So - just call: model.renderAll, to render all... Seriously, couldn't you just look in ICustomModel
  2. All custom rendered blocks must have these methods (techne model or obj, doesn't matter) (in block class): renderAsNormalBlock - return false; getRenderType - return -1; isOpaqueCube - return false;
  3. world.createExplosion Params are self explanatory
  4. You call super.onItemUse first, that will place block for you. Then you use getTileEntityAt, check that it's your te and you can do what ever you want...
  5. To make transperent things to blend (faiding - what is it?), use GL11.glEnable(GL11.gl_BLEND); and GL11.glDisable(GL11.gl_BLEND); This willdraw semi transparent things - semi transparent
  6. Can you post your proxy code? (or wherer you register renderers)
  7. When an item representing tileentity is renderer, it has no world nor pos values. That's why it crahes.
  8. MCP conf folder is in you(user)\.gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-10.13.2.1291(your forge version here)\unpacked\conf
  9. 1) As i said, you need packets, other wise it won't work. 2) Please, don't call Minecraft.class on server, it is client side only...
  10. Okay, i finally resolved problem of pyramid being simple box. Now it is pyramid: (Height 100, border degree 30):
  11. I met same issue few days ago... You need to sync them via packets... HINT: start sync, when player joins world (EntityJoinWorldEvent)(check if it is player!).
  12. About they aren't there... Just add them and define in constructor! And also, code for your gui, centered (just replace whole class GuiLexicon with that and it will work): public class GuiLexicon extends GuiScreen { int guiWidth = 192; int guiHeight = 256; int guiLeft = 0; int guiTop = 0; public GuiLexicon() { guiLeft = (width - guiWidth) / 2; guiTop = (height - guiHeight) / 2; } static int GUI_ID = 30; @Override public void drawScreen(int mouseX, int mouseY, float par3) { super.drawScreen(mouseX, mouseY, par3); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(SignificantAdvancements.MODID, "textures/guis/lexiconBackground.png")); this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, guiWidth, guiHeight); int stringWidth = this.fontRendererObj.getStringWidth(I18n.format("lexiconOfKnowledge.lang")); this.fontRendererObj.drawString(I18n.format("lexiconOfKnowledge.lang"), guiWidth - stringWidth, 50, 0x00FFFF, true); } }
  13. I know that. I was speaking about scanning them for each bounding box is too much... And i found a way to avoid it: in the beginning i collect all entities in range in special list, and then, in each bounding box, just checking entities from list. Like that i'm doing worldObj.getEntitiesWithinAABB(Boundingbox) only once... And it works, without lag on range 25!!!
  14. Actually: 1) it depends on conditions of player, for block to be removed. 2) I managed to find lag problem: entities detection (blocks one doesn't cause any lag at all, with nullifying) 3) It happens because, it's iterating through everybody. There's no other way? Or there's?
  15. Resource location is defined wrong. It thinks that when it only one arg, it's mc's resource, so it becomes something like minecraft:apocalypse:sounds.Siren. To avoid this, use second resource location constructor(with 2 strings: 1st-domain, 2nd-resource).
  16. If you read carefully through code, i'm not converting pyramid in one bounding box, but in tons of small ones that are created each tick from min and max coords written before, just to detect blocks & entities... Here's aproximative image: You said, that i'm not cleaning up behind me. So how do i do it? I Can't just nullifiy objects - only references will be nullified...
  17. Okay, i modified code with console statements: public class PositionnedRotatedRangedVec3 { private static Logger logger = LogManager.getLogger("Pyramidal Vec3"); private World worldObj; private double posX; private double posY; private double posZ; private float rotYaw; private float rotPitch; private float rotR; private double range; public PositionnedRotatedRangedVec3(World worldObj, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, float rotR, double range) { setData(worldObj, posX, posY, posZ, rotationYaw, rotationPitch, rotR, range); } public void setData(World worldObj, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, float rotR, double range){ this.worldObj = worldObj; this.posX = posX; this.posY = posY; this.posZ = posZ; this.rotYaw = rotationYaw; this.rotPitch = rotationPitch; this.rotR = rotR; this.range = range; /*Vec3 vec = Vec3Utils.getLookVec(rotationYaw + rotR, rotationPitch + rotR); adjustX = vec.xCoord; adjustY = vec.yCoord; adjustZ = vec.zCoord;*/ logger.info("Created new pyramid: " + this); } public Set<BlockPos> getAffectedBlocks(){ logger.info("Starting blocks section"); Set<BlockPos> blocks = new HashSet<BlockPos>(); Vec3[] vecs = new Vec3[]{Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(posX, posY, posZ)}; boolean arrived = false; logger.info("Initialized arrays and booleans, starting loop"); while(!arrived){ double minX = posX; double minY = posY; double minZ = posZ; double maxX = posX; double maxY = posY; double maxZ = posZ; logger.info("Updating start, values: " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ); for(int i = 0; i < 5; i++){ Vec3 vec = vecs[i]; logger.info("Next vec: " + vec); if(i == 0){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw, rotPitch); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } if(i == 1){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw + rotR, rotPitch + rotR); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } if(i == 2){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw - rotR, rotPitch + rotR); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } if(i == 3){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw + rotR, rotPitch - rotR); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } if(i == 4){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw - rotR, rotPitch - rotR); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } minX = Math.min(minX, vec.xCoord); minY = Math.min(minY, vec.yCoord); minZ = Math.min(minZ, vec.zCoord); maxX = Math.max(maxX, vec.xCoord); maxY = Math.max(maxY, vec.yCoord); maxZ = Math.max(maxZ, vec.zCoord); logger.info("Next vec initialized: " + vec); vecs[i] = vec; } logger.info("Updating end, values: " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ); // AxisAlignedBB box = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); for(int i = (int) minX; i <= maxX; i++){ for(int j = (int) minY; j <= maxY; j++){ for(int k = (int) minZ; k <= maxZ; k++){ logger.info("Adding next block pos: " + new BlockPos(i, j, k)); blocks.add(new BlockPos(i, j, k)); } } } logger.info("Checking for scanned distance"); double dist = vecs[0].distanceTo(Vec3.createVectorHelper(posX, posY, posZ)); logger.info("Distance to pass: " + range); logger.info("Distance passed: " + dist); if(dist >= range){ logger.info("Finished scanning, breaking loop."); arrived = true; break; } } logger.info("Finished scanning, exited loop."); logger.info("Found blocks poss: " + blocks); return blocks; } public Set<Entity> getAffectedEntities(){ Set<Entity> entities = new HashSet<Entity>(); Vec3[] vecs = new Vec3[]{Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(posX, posY, posZ)}; boolean arrived = false; while(!arrived){ double minX = posX; double minY = posY; double minZ = posZ; double maxX = posX; double maxY = posY; double maxZ = posZ; for(int i = 0; i < 5; i++){ Vec3 vec = vecs[i]; if(i == 0){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw, rotPitch); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } if(i == 1){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw + rotR, rotPitch + rotR); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } if(i == 2){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw - rotR, rotPitch + rotR); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } if(i == 3){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw + rotR, rotPitch - rotR); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } if(i == 4){ Vec3 vec2 = Vec3Utils.getLookVec(rotYaw - rotR, rotPitch - rotR); vec = vec.addVector(vec2.xCoord, vec2.yCoord, vec2.zCoord); } minX = Math.min(minX, vec.xCoord); minY = Math.min(minY, vec.yCoord); minZ = Math.min(minZ, vec.zCoord); maxX = Math.max(maxX, vec.xCoord); maxY = Math.max(maxY, vec.yCoord); maxZ = Math.max(maxZ, vec.zCoord); vecs[i] = vec; } AxisAlignedBB box = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); entities.addAll(worldObj.getEntitiesWithinAABB(Entity.class, box)); } return entities; } @Override public String toString() { return "PyramidalVec3{Pos:{" + posX + ", " + posY + ", " + posZ + "}, Rot:{" + rotYaw + ", " + rotPitch + "}, Borders degree: " + rotR + ", Height: " + range + "}"; } } I'll let it run for few minutes and see what is going on... Okay it seems to be laggy on range 50+, so i hope nobody will use it. And also it doesn't do it in pyramidal form... Something is wrong with block detection maybe... Nope, i need to check all calculations, and see what's wrong with vec movement. Strange, mc uses similar code to get entity looking vec, here i'm just adding 40 degrees to it... Do you have any ideas???
  18. To get entity from uuid, loop through world entities and check uuid match...
  19. For players, uuid is always and everywhere the same, get uuid and get player: UUID uuid = EntityPlayer.func_146094_a(player.getGameProfile()); EntityPlayer p = world.func_152378_a(uuid); For entities: entity.getUniqueID() or entity.getPersistentID() For entity getters, you will need to loop through loaded entities and check if uuid matches...
  20. In gui screen you have guiTop, guiLeft, xSize, ySize predefined for you to center your gui. If you don't extend it, you can center it manualy, as i wrote above. (Sir, if you're lazy to do it your self, look above: i posted code for your centered gui, you can use it...) Please reply me, for that i understand that you read this post and tried it...
  21. But then you don't need to cahnge anything in base classes (if with forge). Subscribe to entity join world event, check for being on client, that it's player, do your stuff and send packet to server. There are plenty tutorials about events, packets, forge-bucket packet handling...
  22. I mean that maybe code is run only on one side... Wait, i'll try to repeat what you are doing and see what and where will go wrong...
  23. Nope, it is not.
  24. Probably no... Hint: it's happenning somewhere in Locale.class
  25. Do you want to play your music always??? If you want just to add music, do it like resource pack would...
×
×
  • Create New...

Important Information

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