Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

bxzsj

Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by bxzsj

  1. Thank you! I use GlStateManager.disableCull(); and rectangle is correctly rendered.
  2. Try to use GL11.glRect to draw rectangles. But it don't work. @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { super.drawScreen(mouseX, mouseY, partialTicks); GlStateManager.disableTexture2D(); GL11.glColor4f(1.0f,0,0,1.0f); GL11.glRecti(10,10,50,50); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glRectf(-0.5f, -0.5f, 0.5f, 0.5f); GL11.glPopMatrix(); GlStateManager.enableTexture2D(); GL11.glRecti(10,10,50,50); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glRectf(-0.5f, -0.5f, 0.5f, 0.5f); GL11.glPopMatrix(); } But if I try this: glBegin(GL_POLYGON); glVertex2i(10,10); glVertex2i(10,50); glVertex2i(50,50); glVertex2i(50,10); glEnd(); It works. I find that the difference between GL11.glRect and the above code is glRect(x1, y1, x2, y2) equal glBegin(GL_POLYGON); glVertex2(x1, y1); glVertex2(x2, y1); glVertex2(x2, y2); glVertex2(x1, y2); glEnd( ); but the work one is: glBegin(GL_POLYGON); glVertex2(x1, y1); glVertex2(x1, y2); glVertex2(x2, y2); glVertex2(x2, y1); glEnd( ); The difference between them is that the order of the vertices is different. I don't understand why this is happening. I hope someone can answer. Thank you!
  3. I made a stupid mistake. this.setDefaultState(this.createBlockState().getBaseState().withProperty(FACING, EnumFacing.NORTH)); That makes the state in game never equal state in BlockModelShapes.blockStateMapper Sorry to waste your time.
  4. what you mean, I'm using vanilla "cube" model
  5. I understand, if I don't need to load blockstate json from separated files, it's no need to register block state mapper. Now I removed register block state mapper, but it still don't work. new log
  6. Sorry, I don't know what is a right way to register block state mapper,can you give me some document or tutorials about it? This is the only way I learned from a tutorial. I still haven't figured out how this part works.
  7. the full log is here, nothing about "energy_block"
  8. I'm trying to define a block use vanilla cube model to render with 7 variant,but got some problem that block not be right render. No error show in log(here).(block registry name is "energy_block") Item renders well, but block got wrong. block state in the following picture are correct. no error "Exception loading model for variant" about this block(energy_block). I'm sorry, I don't understand how json to model and connect with block state. I'm not sure if I've done the wrong thing that use a wrong register Block State Mapper(here) source code: block(here) blockstate json(here)
  9. Thank you, I defind a method : public void drawZoomTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height, float textureAreaWidth, float textureAreaHeight, float textureWidth, float textureHeight) { float f = 1.0F / textureWidth; float f1 = 1.0F / textureHeight; Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos((double) x, (double) (y + height), (double) this.zLevel).tex((double) (textureX * f), (double) ((textureY + textureAreaHeight) * f1)).endVertex(); vertexbuffer.pos((double) (x + width), (double) (y + height), (double) this.zLevel).tex((double) ((textureX + textureAreaWidth) * f), (double) ((textureY + textureAreaHeight) * f1)).endVertex(); vertexbuffer.pos((double) (x + width), (double) y, (double) this.zLevel).tex((double) ((textureX + textureAreaWidth) * f), (double) (textureY * f1)).endVertex(); vertexbuffer.pos((double) x, (double) y, (double) this.zLevel).tex((double) (textureX * f), (double) (textureY * f1)).endVertex(); tessellator.draw(); } it works.
  10. Do this defind the location: (double)(x + 0), (double)(y + height), (double)this.zLevel and this defind texture area to display: ? .tex(((textureX + 0) * 0.00390625F), ((textureY + height) * 0.00390625F))
  11. I just tried it , but this method zoom a whole texture(256*256) to 10*10
  12. I want to draw a texture that 40*20 to 10*10,tried to use GlStateManager.scale but got a wrong display,and then I found this drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight) but I don't know what those parameters mean. Could some one tell me how to use it? My texture(png) is 256*256 and texture offsetX is 0,offsetY is 20, width and height to display is 40 * 20 and zoom to 10*10.
  13. I enabled UniversalBucket, but it not solve. How can I replace vanilla bucket with UniversalBucket?
  14. I changed the max stack of the bucket, when more than one bucket water place water ,it always return to one bucket. I found that ItemBucket.onItemRightClick cause this. So,I want to modify it.
  15. new to learn about coremod Here is game log: log Code: github The problem is forge report "Skipping already parsed coremod or tweaker bxzmod-someusefulthings-1.0.jar" and it only load coremod part in my mod. What can I do to solve this problem?
  16. I have solved the model crash. But,my TileEntity doesn't save data. It reported a problem: (log L673) Caused by: java.lang.NullPointerException at com.bxzmod.energyconversion.tileentity.PowerBlockTileEntity.func_145839_a(PowerBlockTileEntity.java:109) ~[PowerBlockTileEntity.class:?] the code is: @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); //LOGGER.info("read" + nbt.toString()); NBTTagList list = new NBTTagList(); this.totalEnergy = nbt.getInteger("totalEnergy"); list = (NBTTagList) nbt.getTag("sideType");//here didn't get nbt tag for (int i = 0; i < 6; i++) this.sideType[i] = ((NBTTagCompound) list.get(i)).getBoolean("side" + i); if (totalEnergy > capacity) { totalEnergy = capacity; } storage.readFromNBT(nbt); } @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt = storage.writeToNBT(nbt); if (totalEnergy < 0) { totalEnergy = 0; } nbt.setInteger("totalEnergy", totalEnergy); NBTTagList list = new NBTTagList(); for(int i = 0; i <6; i++) { NBTTagCompound a = new NBTTagCompound(); a.setBoolean("side" + i, this.sideType[i]); list.appendTag(a); } nbt.setTag("sideType", list); //LOGGER.info("write"+nbt.toString()); return nbt; } I just want to save the block's side config data(as written above the NBTTagList list), but it got an error that once rejoin all side config lose and reset. And then I tried to output the "nbt" (LOGGER.info("read"+nbt.toString());), and find that (log) L650, L671, L674 [13:51:27] [Server thread/INFO]: read{sideType:[0:{side0:0b},1:{side1:0b},2:{side2:1b},3:{side3:0b},4:{side4:0b},5:{side5:0b}],Energy:0,totalEnergy:0,x:-189,y:64,z:235,id:"energyconversion:PowerBlock"} [13:51:28] [Server thread/INFO]: VoiceServer: Starting up server... [13:51:28] [Server thread/INFO]: Changing view distance to 12, from 10 [13:51:31] [Netty Local Client IO #0/INFO]: Server protocol version 2 [13:51:31] [Netty Server IO #1/INFO]: Client protocol version 2 [13:51:31] [Netty Server IO #1/INFO]: Client attempting to join with 22 mods : CodeChickenLib@2.5.9.283,MekanismGenerators@9.2.4,FML@8.0.99.99,theoneprobe@1.4.18,thermalexpansion@5.1.6,tesla@1.2.1.49,inventorytweaks@1.61-58-a1fd884,thermaldynamics@2.0.7,Forge@12.18.3.2422,<CoFH ASM>@000,Baubles@1.3.11,JEI@3.14.7.419,cofhcore@4.1.6,Mekanism@9.2.4,someusefulthings@1.0,mcmultipart@2.0.0_88,MekanismTools@9.2.4,energyconversion@1.0,thermalfoundation@2.1.2,IC2@2.6.234-ex110,mcp@9.19,ccl-entityhook@1.0 [13:51:31] [Netty Local Client IO #0/INFO]: [Netty Local Client IO #0] Client side modded connection established [13:51:31] [Server thread/INFO]: [Server thread] Server side modded connection established [13:51:31] [Server thread/INFO]: 0x00000000[local:E:db3c6b1b] logged in with entity id 390 at (-187.07428959339794, 64.0, 233.18476770205746) [13:51:31] [Server thread/INFO]: 0x00000000 joined the game [13:51:31] [Server thread/INFO]: Sent config to 'TextComponent{text='', siblings=[TextComponent{text='0x00000000', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=ClickEvent{action=SUGGEST_COMMAND, value='/msg 0x00000000 '}, hoverEvent=HoverEvent{action=SHOW_ENTITY, value='TextComponent{text='{name:"0x00000000",id:"e1965b52-bc8f-995f-3766-d820e4b3717b"}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=0x00000000}}], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=ClickEvent{action=SUGGEST_COMMAND, value='/msg 0x00000000 '}, hoverEvent=HoverEvent{action=SHOW_ENTITY, value='TextComponent{text='{name:"0x00000000",id:"e1965b52-bc8f-995f-3766-d820e4b3717b"}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=0x00000000}}.' [13:51:33] [Server thread/INFO]: Saving and pausing game... [13:51:33] [Client thread/INFO]: Minecraft is in offline mode, could not check for updates. [13:51:33] [Client thread/INFO]: [CHAT] InvTweaks: Configuration loaded. [13:51:33] [Netty Local Client IO #0/INFO]: Received config from server. [13:51:33] [Netty Local Client IO #0/INFO]: Received Cardboard Box blacklist entries from server (15 total) [13:51:33] [Thread-15/INFO]: VoiceServer: Starting client connection... [13:51:33] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [13:51:33] [Thread-15/INFO]: VoiceServer: Successfully connected to server. [13:51:33] [VoiceServer Listen Thread/INFO]: VoiceServer: Accepted new connection. [13:51:33] [Thread-17/INFO]: VoiceServer: Traced IP in 1 attempts. [13:51:33] [Server thread/INFO]: write{sideType:[0:{side0:0b},1:{side1:0b},2:{side2:1b},3:{side3:0b},4:{side4:0b},5:{side5:0b}],Energy:0,totalEnergy:0,x:-189,y:64,z:235,id:"energyconversion:PowerBlock"} [13:51:33] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [13:51:33] [Server thread/INFO]: Saving chunks for level 'New World'/The End [13:51:33] [Client thread/INFO]: read{x:-189,y:64,z:235,id:"energyconversion:PowerBlock"} [13:51:33] [Client thread/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_141] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_141] at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?] at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1045) [bcx.class:?] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:371) [bcx.class:?] at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_141] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_141] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_141] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] Caused by: java.lang.NullPointerException at com.bxzmod.energyconversion.tileentity.PowerBlockTileEntity.func_145839_a(PowerBlockTileEntity.java:109) ~[PowerBlockTileEntity.class:?] at net.minecraft.tileentity.TileEntity.handleUpdateTag(TileEntity.java:341) ~[aqk.class:?] at net.minecraft.client.network.NetHandlerPlayClient.func_147263_a(NetHandlerPlayClient.java:728) ~[bll.class:?] at net.minecraft.network.play.server.SPacketChunkData.func_148833_a(SourceFile:96) ~[gt.class:?] at net.minecraft.network.play.server.SPacketChunkData.func_148833_a(SourceFile:18) ~[gt.class:?] at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) ~[fl$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_141] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_141] at net.minecraft.util.Util.func_181617_a(SourceFile:45) ~[h.class:?] ... 9 more L671 The "writeToNBT" output write{sideType:[0:{side0:0b},1:{side1:0b},2:{side2:1b},3:{side3:0b},4:{side4:0b},5:{side5:0b}],Energy:0,totalEnergy:0,x:-189,y:64,z:235,id:"energyconversion:PowerBlock"} L674 The "readFromNBT" Output read{x:-189,y:64,z:235,id:"energyconversion:PowerBlock" do not contain any additional nbt. But other nbt "totalEnergy" and "Energy" works . Just "sideType" got wrong.
  17. Oh,thank you! I change it to @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { IExtendedBlockState s = (IExtendedBlockState) state; PowerBlockTileEntity te = (PowerBlockTileEntity) worldIn.getTileEntity(pos); return s.withProperty(SIDE_CONFIG, te.getByte()); } But , suddenly find that this doesn't work: (TileEntity) @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt = storage.writeToNBT(nbt); if (totalEnergy < 0) { totalEnergy = 0; } nbt.setInteger("totalEnergy", totalEnergy); nbt.setByteArray("sideType", this.bSideType);//this don't work return nbt; } game log show that MC: Caused by: java.lang.ArrayIndexOutOfBoundsException MC: at java.lang.System.arraycopy(Native Method) ~[?:1.8.0_141] MC: at com.bxzmod.energyconversion.tileentity.PowerBlockTileEntity.func_145839_a(PowerBlockTileEntity.java:103) ~[PowerBlockTileEntity.class:?] the code @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.totalEnergy = nbt.getInteger("totalEnergy"); System.arraycopy(nbt.getByteArray("sideType"), 0, this.bSideType, 0, 6);//here the problem if (totalEnergy > capacity) { totalEnergy = capacity; } storage.readFromNBT(nbt); } and my baked model seems not work I tried to use this: (BakedModel) LOGGER.info(extendedBlockState.getValue(PowerBlock.SIDE_CONFIG).toString()); Minecraft.getMinecraft().thePlayer.addChatMessage( new TextComponentString(extendedBlockState.getValue(PowerBlock.SIDE_CONFIG).toString())); to check block state work or not. But I didn't see any message show in game log and chat bar.
  18. All codes : GitHub Model here 1.The block (codes here) can place ,and model works. But get crash when reload world(saved game and rejoin) (I think it cause by can't get extend block state). game log(L729 crash) I find that Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at com.bxzmod.energyconversion.blocks.blockmodel.PowerBlockBakedModel.func_188616_a(PowerBlockBakedModel.java:142) ~[PowerBlockBakedModel.class:?] In my code is (here) @Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) { IExtendedBlockState extendedBlockState; List<BakedQuad> quads = new ArrayList<>(); if (state == null) { for (EnumFacing f : EnumFacing.values()) quads.add(this.setQuad(f, 0)); return quads; } else extendedBlockState = (IExtendedBlockState) state; if (side == null) { return Collections.emptyList(); } byte[] a = extendedBlockState.getValue(PowerBlock.SIDE_CONFIG); quads.add(this.setQuad(side, a[side.getIndex()])); return quads; } Does this crash mean that the model is loaded earlier than TileEntity?Or the parameter "state" not from block.getExtendedState ? And how can I repair it? 2.When I change extend block state in TileEntity(codes here),it doesn't immediate refresh. I need to place a block to refresh it. public void setSideType(EnumFacing form) { this.bSideType[form.getIndex()] = (byte) (this.bSideType[form.getIndex()] == 1 ? 0 : 1); IExtendedBlockState extendedBlockState = (IExtendedBlockState) this.worldObj.getBlockState(this.pos); extendedBlockState = extendedBlockState.withProperty(PowerBlock.SIDE_CONFIG, this.bSideType); } Does this can update extend block state?If not ,how can i update extend block state ,I tried to use this.worldObj.setBlockState ,but crashed. 3.Something I don't know what is wrong. Block side render was effected with it's opposite side.(codes here) This code from Mcjty's tutorial(here)(I don't understand what this mean)(Can someone explain it for me?) private BakedQuad createQuad(Vec3d v1, Vec3d v2, Vec3d v3, Vec3d v4, int num) { Vec3d normal = v1.subtract(v2).crossProduct(v3.subtract(v2)); UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); builder.setTexture(sprite[num]); putVertex(builder, normal, v1.xCoord, v1.yCoord, v1.zCoord, 0, 0, num); putVertex(builder, normal, v2.xCoord, v2.yCoord, v2.zCoord, 0, 16, num); putVertex(builder, normal, v3.xCoord, v3.yCoord, v3.zCoord, 16, 16, num); putVertex(builder, normal, v4.xCoord, v4.yCoord, v4.zCoord, 16, 0, num); return builder.build(); } private void putVertex(UnpackedBakedQuad.Builder builder, Vec3d normal, double x, double y, double z, float u, float v, int num) { for (int e = 0; e < format.getElementCount(); e++) { switch (format.getElement(e).getUsage()) { case POSITION: builder.put(e, (float) x, (float) y, (float) z, 1.0f); break; case COLOR: builder.put(e, 1.0f, 1.0f, 1.0f, 1.0f); break; case UV: if (format.getElement(e).getIndex() == 0) { u = sprite[num].getInterpolatedU(u); v = sprite[num].getInterpolatedV(v); builder.put(e, u, v, 0f, 1f); break; } case NORMAL: builder.put(e, (float) normal.xCoord, (float) normal.yCoord, (float) normal.zCoord, 0f); break; default: builder.put(e); break; } } }
  19. I'm sorry, can you tell me where there are some documents or other tutorials about rendering, extended block state and something helpful for this? I didn't see mentioned on the website. https://mcforge.readthedocs.io/en/latest/ And the IBakedModel.java do not have annotations. I don't know what those methods means and how to use them.
  20. I'm sorry , I don't know the meaning of the log. Could you tell me what's wrong with it? I only set two textures at https://github.com/bxz2311196368/bxzpower/blob/master/src/main/java/com/bxzmod/energyconversion/blocks/blockmodel/PowerBlockBakedModel.java#L39 sprite[0] = bakedTextureGetter.apply(new ResourceLocation(Info.MODID, "blocks/power_block_in")); sprite[1] = bakedTextureGetter.apply(new ResourceLocation(Info.MODID, "blocks/power_block_out")); https://github.com/bxz2311196368/bxzpower/blob/master/src/main/java/com/bxzmod/energyconversion/blocks/blockmodel/PowerBlockModel.java#L28 @Override public Collection<ResourceLocation> getTextures() { return ImmutableSet.of(new ResourceLocation(Info.MODID, "blocks/power_block_in"), new ResourceLocation(Info.MODID, "blocks/power_block_out")); } And there is a problem : https://github.com/bxz2311196368/bxzpower/blob/master/src/main/java/com/bxzmod/energyconversion/blocks/blockmodel/PowerBlockBakedModel.java#L148 @Override public TextureAtlasSprite getParticleTexture() { return sprite[0]; } I have two textures, but it can only return one, so I return one of them. Please help me to check what's wrong.
  21. Thank you! I made a stupid mistake. I changed it to: private TextureAtlasSprite sprite[] = new TextureAtlasSprite[2]; it works. But,I got another crash when rending item. I'am sorry ,I don't know how item render works.So I don't know where it went wrong. game log Crash Report start L608: http://paste.ubuntu.com/25667178/ itemblock render at : https://github.com/bxz2311196368/bxzpower/blob/master/src/main/java/com/bxzmod/energyconversion/blocks/BlockRenderLoader.java#L36
  22. New to modding. Learn from mcjty's tutorials https://wiki.mcjty.eu/modding/index.php/Render_Block_Baked_Model-1.9 Want to set two type textures for every side. Just like RF energy storage show send/receive on each side. game log: Crash Report start L477 http://paste.ubuntu.com/25666108/ codes here: https://github.com/bxz2311196368/bxzpower/tree/master/src/main/java/com/bxzmod/energyconversion/blocks/blockmodel I know error is here: https://github.com/bxz2311196368/bxzpower/blob/master/src/main/java/com/bxzmod/energyconversion/blocks/blockmodel/PowerBlockBakedModel.java#L39 But I don't know how to repair it.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.