TheGreyGhost
Members-
Posts
3280 -
Joined
-
Last visited
-
Days Won
8
Everything posted by TheGreyGhost
-
Hi You might find this useful http://greyminecraftcoder.blogspot.com.au/2013/10/user-input.html a bit out of date; movement is now sent from EntityPlayerSP.onUpdateWalkingPlayer() to update player position, handled on NetHandlerPlayServer.processPlayer looks to me like it just updates the player position directly and doesn't store the 'which direction is player moving' anywhere. -TGG
-
Hi yeah the tint index may also work I think. But even better to just not use ISmartBlockModel. Stick with the ordinary JSON method, it is much easier and also lets people modify your block textures much more easily! Some information about JSON files and how you can make sloped quads http://greyminecraftcoder.blogspot.com.au/2014/12/block-models-18.html A triangle is just a quad with two adjacent corners on top of each other. For example here http://greyminecraftcoder.blogspot.co.at/2014/12/the-tessellator-and-worldrenderer-18.html But perhaps even easier to use a program which can generate them for you (I think BDcraft Cubik can do this - never tried it with triangles I admit) Curious that extending BlockStairs didn't work. That should have been fine. -TGG
-
Hi I don't see an obvious problem, but surely 5 minutes with a test world and your debugger should show you exactly which of your assumptions isn't right? -TGG
-
Hi The direction-dependent lighting is based on face quads and the "shade" flag. In the JSON it is called shade, in the FaceBakery this is one of the flags, or alternatively in your BakedQuad it is one of the ints - see ModelBakery.makeBakedQuad --> FaceBakery.storeVertexData "faces": { "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top" }, vs the torch "shade": false, "faces": { "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" }, "up": { "uv": [ 7, 6, 9, 8 ], "texture": "#torch" } } I think your second problem is related to your Block class definition, not the json, because the lighting is wrong for the adjacent block, not your block itself. When I've seen these symptoms before it's generally been caused by incorrect isOpaqueCube(), incorrect isFullCube() or incorrect block bounds Just curious - why are you using ISmartBlockModel? You can get the same sloped block using ordinary json? -TGG
-
[1.7.10] Need method to autosave server on an interval basis
TheGreyGhost replied to Farrendil's topic in Modder Support
Hi I think what you want is to create a backup of the saved game files every 15 minutes? So that if your saved game gets trashed, you can restore from backup? In that case you need to stop minecraft from continuously saving the world, then copy the files, then resume. command save off command save all copy files command save on I've written a mod that among other things periodically performs a backup copy, see here for inspiration https://github.com/TheGreyGhost/SpeedyTools/blob/master/src/main/java/speedytools/serverside/backup/MinecraftSaveFolderBackups.java and https://github.com/TheGreyGhost/SpeedyTools/blob/master/src/main/java/speedytools/serverside/backup/FolderBackup.java It has some extra functionality you don't need, the core ideas are there. But I'm sure there are other mods around which do that, that's how I figured out what to do in the first place. No luck with google? -TGG -
1.8 make something happen when armor is equipped
TheGreyGhost replied to cdainesy's topic in Modder Support
Hi You might find this mod useful http://www.atomicstryker.net/dynamiclights.php It is designed so that your mod can talk to it - turn on lights, turn them off again. You can even tell it that your helmet should glow. Much easier and faster than reinventing the wheel yourself (and much more likely to work, take it from me). -TGG -
Hi Your message seems to be missing fromBytes and toBytes? This tutorial project has a working example https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe60_network_messages/Notes.txt especially this https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe60_network_messages/AirstrikeMessageToServer.java -TGG
-
Hi There are a couple of ways I can think of - either make your model with faces that overlap (eg two east faces) - don't forget to move one face out by a very small amount (say 0.001) to make sure it renders in front of the other one; or - render in multiple render layers (SOLID, CUTOUT, CUTOUT_MIPPED, TRANSLUCENT) using Block /** * Queries if this block should render in a given layer. * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer */ public boolean canRenderInLayer(EnumWorldBlockLayer layer) { return getBlockLayer() == layer; } I don't think you can map two textures to the same face like your example. -TGG
-
[1.8] Add ambient occlusion to hud blocks
TheGreyGhost replied to Jedispencer21's topic in Modder Support
Hi What you're looking for isn't ambient occlusion, that is something different. http://greyminecraftcoder.blogspot.com.au/2014/12/lighting-18.html Try turning on item lighting RenderHelper.enableStandardItemLighting() -TGG -
Hi You might find this tutorial project for 1.8 useful. It has a custom furnace. (MBE31) https://github.com/TheGreyGhost/MinecraftByExample -TGG
-
Hi N247S is right I think, just use GL11.glRotatef (or GlStateManager.rotate ) At a quick glance, most of that action for vanilla happens here public void renderItemInFirstPerson(float p_78440_1_) { float f1 = 1.0F - (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * p_78440_1_); EntityPlayerSP entityplayersp = this.mc.thePlayer; float f2 = entityplayersp.getSwingProgress(p_78440_1_); float f3 = entityplayersp.prevRotationPitch + (entityplayersp.rotationPitch - entityplayersp.prevRotationPitch) * p_78440_1_; float f4 = entityplayersp.prevRotationYaw + (entityplayersp.rotationYaw - entityplayersp.prevRotationYaw) * p_78440_1_; this.func_178101_a(f3, f4); this.func_178109_a(entityplayersp); this.func_178110_a((EntityPlayerSP)entityplayersp, p_78440_1_); and private void func_178101_a(float p_178101_1_, float p_178101_2_) { GlStateManager.pushMatrix(); GlStateManager.rotate(p_178101_1_, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(p_178101_2_, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); } and private void func_178110_a(EntityPlayerSP p_178110_1_, float p_178110_2_) { float f1 = p_178110_1_.prevRenderArmPitch + (p_178110_1_.renderArmPitch - p_178110_1_.prevRenderArmPitch) * p_178110_2_; float f2 = p_178110_1_.prevRenderArmYaw + (p_178110_1_.renderArmYaw - p_178110_1_.prevRenderArmYaw) * p_178110_2_; GlStateManager.rotate((p_178110_1_.rotationPitch - f1) * 0.1F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate((p_178110_1_.rotationYaw - f2) * 0.1F, 0.0F, 1.0F, 0.0F); } -TGG
-
Hi A couple more suggestions for troubleshooting texture problems here http://greyminecraftcoder.blogspot.com.au/2015/03/troubleshooting-block-and-item-rendering.html -TGG
-
[1.8] Trouble with ore dictionary and recipes
TheGreyGhost replied to TehStoneMan's topic in Modder Support
Hi Perhaps try a two step method like this // g) Shaped Ore recipe - any type of tree leaves arranged around sticks makes a sapling // Ores are a way for mods to add blocks & items which are equivalent to vanilla blocks for crafting // For example - an ore recipe which uses "logWood" will accept a log of spruce, oak, birch, pine, etc. // If your mod registers its balsawood log using OreDictionary.registerOre("logWood", BalsaWood), then your // BalsaWood log will also be accepted in the recipe. IRecipe saplingRecipe = new ShapedOreRecipe(new ItemStack(Blocks.sapling), new Object[] { "LLL", "LSL", ".S.", 'S', Items.stick, // can use ordinary items, blocks, itemstacks in ShapedOreRecipe 'L', "treeLeaves", // look in OreDictionary for vanilla definitions }); GameRegistry.addRecipe(saplingRecipe); If that doesn't work, keep breaking it into smaller pieces eg ItemStack saplingStack = new ItemStack(Blocks.sapling) etc perhaps stepping in with the debugger will help too This is running in init not preInit, yes? -TGG -
No error but still crashes PLEASE HELP
TheGreyGhost replied to PixelPacker's topic in Modder Support
Hi Look carefully.... itemPixelBow = new ItemPixelPick().setUnlocalizedName("ItemPixelPick").setTextureName("ec:itempixelpick"); GameRegistry.registerItem(itemPixelPick, itemPixelPick.getUnlocalizedName().substring(5)); This link gives a bit of help on how to track down this type of error https://www.student.cs.uwaterloo.ca/~cs133/Resources/Java/Debugging/run.shtml -TGG -
Hi Well actually I think it wouldn't do the same thing... case 5: case 6: default: i = b0 | 5; But most of the time when you find code like this that looks a bit strange, it's been autogenerated by the decompiler and probably looks very different in the native code. -TGG
-
Hi I would suggest you create your arm model using techne or MCAnimator or whatever tool you normally use. Then, during RenderHandEvent, bind the player's texture and draw your model of the arm as you normally would for Entities, i.e. ModelRenderer and such. Vanilla drawing of the player's hand is hard to find because of the obfuscated names, if you start at ItemRenderer.renderItemInFirstPerson you can dig down through the various layers and following this down you eventually get to ModelPlayer.func_178725_a or ModelPlayer.func_178102_b which might give you some hints on how to do it. Then just draw the item as a JSON separately. That way you don't need to mess around with the player's skin texture. When rendering your items you are stuck with using the blocks/items texture sheet. You might be able to implement a hacky solution to rebind the texture during a call to ISmartItemModel.handleItemState or similar, but I think it would be fragile. -TGG
-
Grant player temporary lightning immunity
TheGreyGhost replied to SuperJedi224's topic in Modder Support
Yes. There is a forge event called EntityStruckByLightningEvent which will let you cancel lightning damage for the player. -TGG -
Hi Using the technique in MBE15 you can create whatever shape model you want - you just have to generate the appropriate list of BakedQuads for rendering. For example, Forge already has b3d model loader built in which builds (bakes) the list of quads from a parsed B3D file - have a look at the B3DModel and B3DLoader classes, especially B3Dloader.getGeneralQuads. I'm not sure I understand the problem with the binding of the skin, do you mean you want to bind the player's skin to part of your item model? That will be tricky and I don't think the B3Dloader will help you. I would suggest you render the player's arm separately during one of the render events, using entity-rendering code, and not try to render it as part of the item. -TGG
-
Hi Have you done much debugging before? If not, I reckon it's probably worth spending a couple of hours learning how to use Eclipse or IntelliJ to debug a running program- breakpoints, watchpoints, stack frames. This one is for Eclipse which is pretty good start http://www.vogella.com/tutorials/EclipseDebugging/article.html The place I'm suggesting the breakpoint is in the minecraft / forge library Look in the libaries for forgeSrc-1.8-11.14.1.xxxx and you will find the ItemRender class [package] package net.minecraft.client.renderer; @SideOnly(Side.CLIENT) public class ItemRenderer { private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png"); private static final ResourceLocation RES_UNDERWATER_OVERLAY = new ResourceLocation("textures/misc/underwater.png"); /** A reference to the Minecraft object. */ private final Minecraft mc; private ItemStack itemToRender; /** How far the current item has been equipped (0 disequipped and 1 fully up) */ private float equippedProgress; private float prevEquippedProgress; private final RenderManager renderManager; private final RenderItem itemRenderer; /** The index of the currently held item (0-8, or -1 if not yet updated) */ private int equippedItemSlot = -1; private static final String __OBFID = "CL_00000953"; public ItemRenderer(Minecraft mcIn) { this.mc = mcIn; this.renderManager = mcIn.getRenderManager(); this.itemRenderer = mcIn.getRenderItem(); } public void renderItem(EntityLivingBase entityIn, ItemStack heldStack, ItemCameraTransforms.TransformType p_178099_3_) { if (heldStack != null) { Item item = heldStack.getItem(); Block block = Block.getBlockFromItem(item); GlStateManager.pushMatrix(); You can also use the search function to jump straight to a class definition, for example in IntelliJ it's ctrl-N (don't know in Eclipse). The problem might be something to do with the stage property but it's too hard to tell just by looking at the code, using the debugger really is the fastest way for you to track it down... -TGG
-
Hi It sounds pretty weird alright. But there must be some subtle difference you're just not seeing. I would suggest hold the weird texture item in your hand, then put a breakpoint in here ItemRenderer.renderItem() and trace it through to here and see why it can't get the right model: public void renderItemModelForEntity(ItemStack stack, EntityLivingBase entityToRenderFor, ItemCameraTransforms.TransformType cameraTransformType) { IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack); Then do the same for the good texture item in your hand, and see if you can spot the difference. -TGG
-
Hi This tutorial project has several examples of how to make models for items https://github.com/TheGreyGhost/MinecraftByExample MBE10, MBE11, MBE12, MBE15. -TGG
-
Hi Are you using IntelliJ 14? If so, it doesn't copy resources to the right place. See dieSieben's post on this in the tutorials subforum. http://www.minecraftforge.net/forum/index.php/topic,21354.msg108332.html#msg108332 It's also worth trying the all-lower-case suggest from spider You could also look on your disk directly to make sure the folder is copied to the right place during build In my case, the resources folders get copied to here C:\Users\TGG\IdeaProjects\MinecraftByExample\build\classes\main eg C:\Users\TGG\IdeaProjects\MinecraftByExample\build\classes\main\assets\minecraftbyexample\textures\items -TGG
-
Hi Try putting a breakpoint here Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(This.modid + ":" + item.getUnlocalizedName().substring(5), "inventory")); and seeing whether it gets added to the registry properly. Your item or item name may not be what you expect. -TGG