Jump to content

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Hi The jump from 1.7.10 to 1.8 is a big one. From 1.8 to 1.8.9 is pretty trivial. 1.8 has been around for more than a year now which is a very long time in Minecraft terms. By upgrading to the latest forge version, you get more new users. But it's not as satisfying as adding new features. Personally, I'd say to freeze your 1.7.10, convert to 1.8, and keep going with new features then. -TGG
  2. Hi This example shows how you can do it. It's for 1.8.9 but is the same as for 1.7.10 1) override Block.getLightValue() https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe31_inventory_furnace/BlockInventoryFurnace.java and 2) if your block is a TileEntity - force block re-rendering and re-lighting when the TE state changes. i.e. in your TileEntity @Override public void update() { you should have if (worldObj.isRemote) { worldObj.markBlockForUpdate(pos); } worldObj.checkLightFor(EnumSkyBlock.BLOCK, pos); whenever your block's state has changed and the light level is different. -TGG
  3. Hi You might find this sample code useful https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe40_hud_overlay -TGG
  4. Hi Have you seen this guide? http://greyminecraftcoder.blogspot.com.au/2015/01/gui-containers.html and this sample code https://github.com/TheGreyGhost/MinecraftByExample It sounds like your onDataPacket() and/or getDescriptionPacket() aren't right. Try putting breakpoints or System.out.println() in there to see what's happening. Cheers TGG
  5. Hi I have updated MinecraftByExample to work with 1.8.9. Actually not many changes were required; a couple of tessellator functions, ModelLoader and some vanilla name changes. See here https://github.com/TheGreyGhost/MinecraftByExample The purpose of MinecraftByExample is to give simple working examples of the important concepts in Minecraft and Forge. If you're anything like me, a good code example is worth several screens' worth of waffling explanation, and can very quickly explain the key concepts. I also find it much easier to adapt and debug something that already works, than to have to synthesise something from scratch and spend hours trying to discover the missing bit of information I didn't know about. List of examples Blocks MBE01 - a simple cube MBE02 - a block with a more complicated shape MBE03 - a block (coloured signpost) with multiple variants- four colours, can be placed facing in four directions MBE04 - a camouflage ("secret door") block which copies the appearance of adjacent blocks - uses ISmartBlockModel MBE05 - a 3D web which joins to neighbours in all six directions - uses ISmartBlockModel and ICustomModelLoader MBE06 - several different types of block which use redstone MBE08 - how to add a creative tab for organising your custom blocks / items Items MBE10 - a simple item MBE11 - an item with multiple variants - rendered using multiple models and multiple layers MBE12 - an item that stores extra information in NBT, also illustrates the "in use" animation similar to drawing a bow MBE13 - customise Mining behaviour of Blocks and Items - several test classes that show how mining works MBE14 - an interactive helper tool to adjust the ItemCameraTransforms for your custom item MBE15 - a chessboard item with 1 - 64 pieces; uses ISmartItemModel TileEntities MBE20 - using a tile entity to store information about a block - also shows examples of using NBT storage MBE21 - using the TileEntitySpecialRenderer to render unusual shapes or animations Containers (Inventory blocks) MBE30 - a simple container for storing items in the world - similar to a Chest MBE31 - a functional container such as a Furnace or Crafting Table Recipes (Crafting and Furnaces) MBE35 - some typical example crafting recipes and furnace (smelting) recipes HeadsUpDisplay - overlays MBE40 - simple customisations of the heads up display (hotbar, health meter) EntityFX - particle effects MBE50 - shows how to use vanilla EntityFX; also how to generate your own custom EntityFX Network MBE60 - send network messages between client and server Configuration GUI MBE70 - configuration file linked to the "mod options" button GUI on the mods list screen Testing tools MBE75 - a tool to help you automate testing of your classes in-game. -TGG
  6. Hi I think you're right about the reason why rotation isn't working. That magic all happens in FaceBakery.makeBakedQuad(), from ModelBakery.bakeModel(), from IModel.bake() Starts from ModelBlockDefinition.parseRotation() originally, goes through ModelBakery.bakeBlockModels(variant.getRotation()). I imagine that the loader bypasses a critical step in that. I think you might have success at this line final IFlexibleBakedModel bakedModelCore = subComponent.bake(state, format, bakedTextureGetter); but to be honest the whole model stuff makes my teeth ache and I'm not 100% sure how it works myself. Apparently there is also a new, more flexible Forge model format, but I haven't worked with it. You can find a bit more information about the vertex model in here, if you're interested, but I think you can probably get it to work at a higher level than that. https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe15_item_smartitemmodel/ChessboardSmartItemModel.java (See vertexToInts() and createBakedQuadForFace()) If you figure it out, please let me know and I'll add it to MBE05.... -TGG
  7. Hi The vanilla JSON can't generate triangles because there is no way to specify two of the four vertices to be the same. I reckon your best bet is to use B3D. BDcubik is apparently a useful tool for that, never used it myself. Mr Crayfish does great stuff so maybe Lothrazar's idea is good too. If you want to go the custom loader route, look at MBE04, MBE05, MBE15 here: (working examples) https://github.com/TheGreyGhost/MinecraftByExample -TGG
  8. Hi The vanilla logic for placing the painting entities is rather hard to follow. Depending on the size of the painting, it moves the origin to a different position from where you clicked. I suggest you find a vanilla painting which is the same size as yours and see what happens to the entity [x,y,z] when it is placed. -TGG
  9. @dieSieben Yeah I don't know why they have that rule. Their uploader also has some serious bugs which means it often doesn't work. But apart from that the site is really good and very popular. -TGG
  10. Hi Once you've built your mod, I'd suggest you first get a few of your real-life friends to try it out and flush out some of the bugs for you. Especially multiplayer Open To LAN. Once it's ready for public consumption you can post it on a site like http://www.minecraftforum.net/ or http://www.planetminecraft.com/ It's not too tricky, once you've created an account you can upload your mod - PlanetMinecraft will upload a file, for minecraft forum you will need to post a link to your file hosted somewhere else (for example, https://www.dropbox.com/). PlanetMinecraft will only accept .zip for some reason, but all you need to do is rename your .jar to .zip. It's worth spending a bit of time on the mod description, installation instructions, and a few good screenshots and a short YouTube showcase will help a lot too. A google will also show you a few tutorials on getting your mod properly packaged, versions etc correct. -TGG
  11. Hi It doesn't matter whether your section is rendered first or last, the depth culling should take care of it. It seems pretty obvious to me that the ring is rendering below the blocks, I think there must be something wrong with your y-position. I think it is here tessellator.addVertexWithUV(cornerX, y+height, cornerZ, minu, minv); You have already translated by y so you shouldn't have y in there. -TGG
  12. Hi If you're using arbitrary colours, then yes you will. If you want, you could copy the face information from the loaded json model and overwrite just the colour ints in the int[], leaving the x,y,z, u,v information unchanged. -TGG /** * Converts the vertex information to the int array format expected by BakedQuads. * @param x x coordinate * @param y y coordinate * @param z z coordinate * @param color RGBA colour format - white for no effect, non-white to tint the face with the specified colour * @param texture the texture to use for the face * @param u u-coordinate of the texture (0 - 16) corresponding to [x,y,z] * @param v v-coordinate of the texture (0 - 16) corresponding to [x,y,z] * @return */ private int[] vertexToInts(float x, float y, float z, int color, TextureAtlasSprite texture, float u, float v) { return new int[] { Float.floatToRawIntBits(x), Float.floatToRawIntBits(y), Float.floatToRawIntBits(z), color, Float.floatToRawIntBits(texture.getInterpolatedU(u)), Float.floatToRawIntBits(texture.getInterpolatedV(v)), 0 }; }
  13. Hi You might get some useful clues from this code for rendering a TESR, if you want to turn world lighting on. https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe21_tileentityspecialrenderer/TileEntitySpecialRendererMBE21.java OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, SKY_LIGHT_VALUE * 16.0F, BLOCK_LIGHT_VALUE * 16.0F); Alternatively, depending on the event you're using for your rendering, the EntityFX rendering might also have stuff of interest Entity.getBrightnessForRender() - in particular see EffectRenderer.renderLitParticles() and EffectRenderer.renderParticles() -TGG
  14. Hi (1) first check that your models really are the cause of slow rendering (2) make your models simpler. Minecraft is supposed to look blocky after all (3) If your models don't change shape often, compile them to a display list (Minecraft entities do this already - see ModelRenderer.render()) -TGG
  15. Hi The key bits to put together are: - the loading methods in MBE04 or MBE05 which are used to insert your model into the registry. Your model can be just an IBakedModel, it doesn't have to be smart. - your IBakedModel class should return the custom quads for your model in getGeneralQuads in MBE15. -TGG
  16. Hi You might find this link helpful http://www.terryanderson.ca/debugging/run.html -TGG
  17. Hi Most of those you don't need to worry about, they are just other parts of the mod I took the code from. I forgot to include the UsefulFunctions method, which you will need. public static Method findMethod(Class clazz, String[] methodNames, Class<?>... methodTypes) { Exception failed = null; for (String methodName : methodNames) { try { Method m = clazz.getDeclaredMethod(methodName, methodTypes); m.setAccessible(true); return m; } catch (Exception e) { failed = e; } } throw new ReflectionHelper.UnableToFindMethodException(methodNames, failed); } Unfortunately since the server side also checks the reach distance, you will need to do a similar trick on ItemInWorldManager as well. I don't have sample code for that because I used the extended reach client side only to send an AttackMessageToServer (to drop pigs from the sky onto the player's head) instead of using the vanilla block damaging code, which is in NetHandlerPlayServer.processPlayerDigging(). It will be tricky to get right without a fair bit of work to understand the vanilla code, plus trial and error. If there's an easier way, I don't know what it is. -TGG
  18. Hi Some examples of these Some info on the tint index http://greyminecraftcoder.blogspot.com.au/2014/12/block-models-18.html using Block.colorMultiplier() Alternatively, this tutorial project shows how you can bake your own models with custom faces / face colours https://github.com/TheGreyGhost/MinecraftByExample (see MBE04, MBE05 for block model generation and MBE15 for how to generate quads) -TGG
  19. Hi I think this is about the easiest way you're likely to find. If you find an easier one, please let me know and I'll implement it too -TGG
  20. Hi You can hook into one of the block damaging events, and when you render your block (should be a TileEntity) check to see if the block being damaged is that one. See here for background info http://greyminecraftcoder.blogspot.ch/2015/01/mining-blocks-with-tools.html -TGG
  21. Hi I used Reflection to do this, perhaps you can implement something similar - it's a bit of a hack but it worked ok. The code below might help you understand the key ideas behind it. public class ReplacePlayerControllerMPHandler { @SubscribeEvent public void worldLoadEvent(WorldEvent.Load event) { if (event.world instanceof WorldClient) { Minecraft mc = Minecraft.getMinecraft(); PlayerControllerMP playerControllerMP = mc.playerController; if (!(playerControllerMP instanceof PlayerControllerMPHijack)) { mc.playerController = PlayerControllerMPHijack.createFromVanilla(playerControllerMP); } } } } /** * Hijack various parts of PlayerControllerMP to extend the block reach distance */ @SideOnly(Side.CLIENT) public class PlayerControllerMPHijack extends PlayerControllerMP { private static Method syncCurrentPlayItemMethod; public static PlayerControllerMPHijack createFromVanilla(PlayerControllerMP playerControllerMP) { NetHandlerPlayClient netHandlerPlayClient = ReflectionHelper.getPrivateValue (PlayerControllerMP.class, playerControllerMP, "netClientHandler", "field_78774_b"); PlayerControllerMPHijack retObj = new PlayerControllerMPHijack(Minecraft.getMinecraft(), netHandlerPlayClient); WorldSettings.GameType gameType = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, playerControllerMP, "currentGameType", "field_78779_k"); ReflectionHelper.setPrivateValue(PlayerControllerMP.class, retObj, gameType, "currentGameType", "field_78779_k"); syncCurrentPlayItemMethod = UsefulFunctions.findMethod(PlayerControllerMP.class, new String [] {"syncCurrentPlayItem", "func_78750_j"}, new Class [] {}); return retObj; } private PlayerControllerMPHijack(Minecraft mcIn, NetHandlerPlayClient netHandlerPlayClient) { super(mcIn, netHandlerPlayClient); } @Override public float getBlockReachDistance() { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; if (player == null) return super.getBlockReachDistance(); ItemStack heldItem = player.getHeldItem(); if (heldItem != null && heldItem.getItem() instanceof ItemStick) { ItemStick itemStick = (ItemStick)heldItem.getItem(); return itemStick.getReachDistance(heldItem, super.getBlockReachDistance()); } else { return super.getBlockReachDistance(); } } // copied from base class @Override public void attackEntity(EntityPlayer playerIn, Entity targetEntity) { try { syncCurrentPlayItemMethod.invoke(this); } catch (Exception e) { throw new RuntimeException("Could not invoke syncCurrentPlayItem()", e); } // this.syncCurrentPlayItem(); AttackMessageToServer attackMessageToServer = new AttackMessageToServer(targetEntity); StartupCommon.simpleNetworkWrapper.sendToServer(attackMessageToServer); if (getCurrentGameType() != WorldSettings.GameType.SPECTATOR) { playerIn.attackTargetEntityWithCurrentItem(targetEntity); } } } public class StartupClientOnly { public static void preInitClientOnly() { MinecraftForge.EVENT_BUS.register(new ReplacePlayerControllerMPHandler()); } public static void initClientOnly() { } public static void postInitClientOnly() { } } -TGG
  22. Hi You might find this tutorial project useful https://github.com/TheGreyGhost/MinecraftByExample MBE31 has an example of a custom furnace that explains the slot numbering a lot better than looking at vanilla. -TGG
  23. Hi I can't tell if it's just the strange formatting or if your code is just really messed up but it looks to me like there are some pretty weird parts in there for (int i = 0; i < (int)(new Random().nextFloat() * 3000); i++) if (!doParticle(world)) return; I really don't think that will do what you think it does! Try running through it in your debugger and seeing what happens. If you cut those two lines out of your method you will see at least one particle, I reckon. -TGG
  24. Hi This link might help http://greyminecraftcoder.blogspot.com.au/2015/07/entity-rotations-and-animation.html Also some of these utility classes MathHelper normalizeAngle, wrapAngleTo180, Vec3 rotatePitch, rotateYaw -TGG
  25. Hi You might find this link useful http://greyminecraftcoder.blogspot.com.au/2015/07/entity-rotations-and-animation.html -TGG
×
×
  • Create New...

Important Information

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