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

TheGreyGhost

Members
  • Posts

    3280
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by TheGreyGhost

  1. Howdy Look in BlockModelRenderer renderModelFlat, renderQuadsFlat IForgeVertexBuilder::applyBakedLighting The rendering of quads is a bit unusual; there is logic that takes the maximum of the world lighting and the "baked quad" lighting. If you generate your own quads in a custom BakedModel (see the mbe examples) you should be able to bake maximum light into some quads and use the world lighting for other quads -TGG
  2. Hi This working example tutorial project has a number of examples on how to render blocks using block models and how to render blocks using TER https://github.com/TheGreyGhost/MinecraftByExample -TGG
  3. Howdy You might find this working example tutorial project useful https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe21_tileentityrenderer -TGG
  4. I agree, they can define their derived units of measure to be whatever they want (in terms of conversion from the smallest possible unit i.e. atom or bucket ounce etc ), and display it to the user however they want. I don't think that needs to be standardised between mods? I think the proposed 1296 ounces (81 * 16) seems a reasonable tradeoff between granularity (from a user's point of view) and the maximum blocks in an int (i.e. 2^31 / 1296 ~ 1.6 million) nugget 16 oz ingot 144 oz block 1296 oz pane 81 oz 1296 seems to be a good number if you just throw away the milliBuckets name and replace it with something non-metric. For folks raised in metric countries, milliBuckets != 1/1000 is extremely confusing. An alternative thought - perhaps you want even divisibility by each "voxel" in a block, i.e. 16x16x16 = 4096, x 81 = 331776 atoms per block ounce = 256 atoms nugget = 16 oz = 4096 atoms ingot = 144 oz = 36864 atoms block = 1296 oz = 331776 atoms voxel = 81 atoms single line = 16 voxels = 1296 atoms pane = 16 lines = 20736 atoms block = 16 panes = 331776 atoms That give you a maximum of ~6400 blocks in a single 31 bit int. That seems like plenty?
  5. Howdy The visibility-behind-blocks is related to the renderbuffer settings - related to the depth buffer. If you google for depth buffer you should find a stack of stuff. Basically - your line drawing is ignoring the depth buffer, and your green rectangles are checking the depth buffer (i.e. they check to see if they are behind a block that has already been drawn). You may need a custom renderbuffer to achieve that (see the williewillus link I sent, Botania has a few custom renderbuffers which should help you out; or alternatively this one https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/usefultools/RenderTypeHelper.java) To move the rendering relative to the block , use something similar to this: // When the TER::render method is called, the origin [0,0,0] is at the current [x,y,z] of the block being rendered. // The tetrahedron-drawing method draws the tetrahedron in a cube region from [0,0,0] to [1,1,1] but we want it // to be in the block one above this, i.e. from [0,1,0] to [1,2,1], // so we need to translate up by one block, i.e. by [0,1,0] final Vec3d TRANSLATION_OFFSET = new Vec3d(0, 1, 0); matrixStack.push(); // push the current transformation matrix + normals matrix matrixStack.translate(TRANSLATION_OFFSET.x,TRANSLATION_OFFSET.y,TRANSLATION_OFFSET.z); // translate Color artifactColour = tileEntityMBE21.getArtifactColour(); drawTetrahedronWireframe(matrixStack, renderBuffers, artifactColour); matrixStack.pop(); // restore the original transformation matrix + normals matrix Cheers TGG
  6. OK. So I still need to include that mod's source (or just the jar?) as a library, but if the other mod isn't present then my code will still run (even though the capability interface isn't present). Could you point me in the direction of a working example? TGG
  7. Ah, ok. I think you have two choices then: TileEntityRenderer (mbe21 in that github link), or (possibly) a multilayer block (similar to the mbe05 lantern) - you may also need a custom BlockModel to render the glowing layer at full brightness regardless of the daylight and blocklight nearby I would suggest TileEntityRenderer if you only have a few of these blocks in the world at once(the rendering is easier to customise, and you can animate easily as well), or if you have many different types of flower that the block must store (say 50 or more) If you have a lot of these blocks in the world, or you want them to be shaded like normal blocks ("ambient occlusion") then the multilayer block is probably better, but will probably be trickier to get right. -TGG
  8. Howdy MatrixStack is for rendering only. Check out EntitySize and EntityType, and SlimeEntity::getSize -TGG
  9. Howdy folks I'm currently investigating Forge Capabilities and there's one aspect that I haven't figured out yet. If I want to access a Capability introduced by another mod, how am I supposed to do that? For inbuilt Capability (such as CapabilityItemHandler) it's no problem, but for anything defined by another mod I can't see an obvious way to access the Capability and its interface (unless of course I include the mod source as a library / dependency). How is that intended to work? -TGG
  10. If you just want to change the appearance of normal blocks, you can use a resource pack without any coding at all. Blockbench tutorials (google) will show you how.
  11. Hi There are a few examples of different ways to generate block models in this tutorial project: https://github.com/TheGreyGhost/MinecraftByExample see mbe03, mbe04, mbe05. But it mostly comes down to what you mean by "glow". For example - the lamp block glows. Do you mean some sort of animated "halo"? Do you have a "concept" art that shows what effect you're trying to achieve, or something else in minecraft that is similar? -TGG
  12. Howdy You might find this documentation-with-diagrams helpful: logical sides (isRemote etc) http://greyminecraftcoder.blogspot.com/2020/02/the-client-server-division-1144.html dedicated server distribution vs client distribution (Dist.DEDICATED_SERVER etc) http://greyminecraftcoder.blogspot.com/2020/02/minecraft-distributions-client-vs.html I.e. there's nothing wrong with your @SubscribeEvent. This line is the problem: if (!e.player.world.isRemote) return;
  13. Howdy In 1.15.2 you should use RenderBuffers, not direct GL11 calls, and use the MatrixStack. Check out this post https://gist.github.com/williewillus/30d7e3f775fe93c503bddf054ef3f93e And also this working example https://github.com/Vazkii/Botania/blob/master/src/main/java/vazkii/botania/client/core/handler/BlockHighlightRenderHandler.java -TGG
  14. Howdy You need to store the information inside an ItemStack. A unique ItemStack is created every time your Item is spawned: ItemStack is the class used when an Item is actually "created" - in addition to the Item type, it also stores the item count (eg a stack of 46 planks), "damage" (eg pickaxe "wear-and-tear" indicator), and several other pieces of information The easiest way to do that is NBT, for a working example see here https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe11_item_variants or here https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe12_item_nbt_animate Like the other folks said, you can use a Capability but that is considerably more complicated / difficult to understand and isn't necessary unless you want other mods to be able to read/control the power of your item without knowing what kind of item it is. -TGG
  15. So what I think the goals are, based on the discussion above: 1) the user wants to think in easy ratios for recipes- nuggets, ingots, blocks 2) the user wants to think in easy ratios for panes - a pane is 1/16 of a block 3) the choice of the "atom" ("bucket ounce" or just "ounce" or "grain" or "blob" or whatever) should ensure that panes, nuggets, ingots, and block can be represented as an integral number of atoms, which ensures conservation of mass during conversion. The milliBucket could be maintained but would be a representation (rounded off) of the actual number of atoms; eg 1 ingot is approximately 111 millibuckets, not exact. Recipes etc use the atoms, not millibuckets. If a method does take millibuckets as an input, it would be rounded to the nearest atoms. A recipe for making panes would either have left over partial nuggets, or would throw some away in a round trip (nuggets -> panes -> nuggets) but that's unavoidable unless you enforce nuggets -> blocks -> panes.
  16. Well to be honest, it's not quite as simple as that, because folks want milliBuckets, i.e. divisible by 1000 If our desired "whole units" are: 1 bucket 1 nugget 1 ingot 1 block 1 mBucket i.e. 1/1000 of a block and the conversions are 1 bucket = 1 block 1 block = 9 ingots (3^2) 1 ingot = 9 nuggets (3^2) 1 block = 1000 mBuckets (2^3 * 5^3) then if you want to retain integral numbers for all of those units, you need to define "1 atom" = the smallest indivisible unit --> 81,000 times smaller than a block i.e. 1 mBucket = 81 atoms 1 nugget = 1000 atoms 1 ingot = 9000 atoms 1 block = 1 bucket = 81000 atoms if you're measuring atoms using 32 bit ints, this is still reasonable (can hold up to 50,000 blocks' worth which seems like plenty) Even if you want to add a further divisibility into 1/16 of a block (i.e. panes), it probably still works (-> max value of 25,000 blocks) 1 atom = 1 / 162,000 of a block i.e. 1 mBucket = 162 atoms 1 nugget = 18,000 atoms 1 ingot = 2,000 atoms 1 block = 1 bucket = 162 atoms 1 pane = 10,125 atoms But it seems very silly to me to define a milliBucket as anything except 1/1000 of a Bucket. I think this discussion would benefit a lot from systematically writing down what the goals of the users are from a gameplay perspective. TGG I agree with you for (1), (3), and (4). I don't understand what you mean for (2): You're right that many numbers can't be exactly represented by floats, there is a round off problem, but there are many ways to deal with that. In practice the roundoffs are so small you would never notice from a user's point of view. To paraphrase your final statement - you need to define an atom, the smallest indivisible unit. "milliBuckets" is a red herring.
  17. Howdy >I was wondering how could I remove durability each time I right click. And also maybe set a cooldown and make it do sword damage. Not sure what you mean by cooldown. But if you mean "the sword can't be used for lightning again until a certain amount of time has elapsed" then I would suggest doing this: 1) Add an NBT "lastused" to your Item eg see this working example https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe12_item_nbt_animate or this https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe11_item_variants 2) Create a 'global tick counter' class which gets called every tick and just keeps track of the number of ticks that the game has been running. For example like this public class AnimationTickCounter { public static long getTotalElapsedTicksInGame() { return totalElapsedTicksInGame; } @SubscribeEvent public static void clientTickEnd(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.END) { totalElapsedTicksInGame++; } } private static long totalElapsedTicksInGame = 0; } //and in your mod constructor use MinecraftForge.EVENT_BUS.register(AnimationTickCounter.class); 3) Check the "lastused" against the global tick counter in order to see if the sword has cooled down yet -TGG
  18. Howdy You might find this link useful - it is a working example of how model rotations work, including an 'interactive' tool for adjusting your model parameters by typing commands- makes it a lot easier to tweak the render translations and rotations. https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe80_model_renderer Off the cuff- the rotation point is probably not correct. i.e. when your head tilts back, the y origin of rotation in your model doesn't correspond to the centre of rotation of the head. -TGG
  19. Howdy There are a couple of ways I think you can do this- 1) Create your own custom IBakedModel for your item- this will let you set whatever transform and whatever rendering you want. You alter the getItemCameraTransforms(), not the MatrixStack or (similar) 2) Use an ISTER for your item which lets you use a TileEntity renderer - again lets you set the transform and rendering, but gives you more flexilibity about the shape/appearance of the item that you draw There's a working example of the first one here - it alters the quads not the transform, but hopefully it's clear how you could adapt it. https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe15_item_dynamic_item_model The second one - search this forum for ISTER, there was someone else recently doing the same thing -TGG
  20. Howdy From a physical interpretation point of view, I think it really boils down to either 1) You define a single base indivisible unit (such as a nugget, or if that's too big, then a "molecule" of fluid) and make sure all your derived units are an integer multiple of those; or 2) You permit folks to use fractions of a unit (i.e. use floats instead of ints) - perhaps by adding new methods to your interface; or 3) You ensure that conversions between units (when topping up buckets) automatically converts using a float factor with a separately-tracked residual (think ticks and partialticks); or 4) Your change your gameplay definition so that nine ingots won't fit into one bucket, i.e. if you try to fit nine ingots into a bucket you get a full bucket, but when you try to convert back from the bucket into ingots, you only get (eg) eight. The rest is "lost during the melting and casting process". -TGG
  21. Howdy Your base and your top are not quads, they're circles. You need to tessellate them to quads in Blender -TGG
  22. Howdy You seem to have already tried the things I'd normally suggest. Odd that some of the internal faces are fine, but others aren't. Some thoughts on how you could progress further: 1) See if the problem persists when you turn ambient occlusion rendering off in the settings 2) Put a breakpoint into IForgeBakedModel.getQuads with a conditional trigger for your blockstate. Then trace out into renderModelFlat and watch carefully the values that it uses for brightness (the lightmap) This will narrow things down to which part of your block, model, or quads is not right - eg whether the block's light is correct or not (and why not), or whether there's a setting wrong in your model or your block). Simplifying your model to just one component might also be helpful. I've managed to solve a number of weird lighting problems that way. -TGG
  23. Two possible reasons come to mind: 1) you need to use loot tables now. eg https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/resources/data/minecraftbyexample/loot_tables/blocks 2) you're mining in creative mode -TGG
  24. Please add your blender model i.e. the .blend file... -TGG
  25. Howdy That sounds like it could be a bug, yeah. I rely on something similar for my mods - i.e. finding and replacing the IBakedModels, and my code works fine even with F3+T. My registration is subtly different for the variant ResourceLocation but everything else looks very similar. I can't see how that would cause your problem, it might be something related to ISTER (which my code doesn't use) As a workaround, you could perhaps change your base item model json to builtin/entity (so that your wrapper doesn't need to override isBuiltInRenderer()) and if necessary move your base json shape to a second model which your wrapper uses instead of the base item MRL. I did put a breakpoint into both ItemModelMesherForge::rebuildCache and ItemModelMesher::rebuildCache, and when I press F3+T it does call ItemModelMesherForge::rebuildCache so I'm not sure that your conclusion is correct: "The problem is that it seems like the ItemModelMesher's cache is not rebuilt after a resource reload." -TGG // Called after all the other baked block models have been added to the modelRegistry // Allows us to manipulate the modelRegistry before BlockModelShapes caches them. @SubscribeEvent public static void onModelBakeEvent(ModelBakeEvent event) { // Find the existing model for ChessBoard - it will have been added automatically by vanilla due to our registration of // of the item in StartupCommon. // Replace the mapping with our custom ChessboardModel. ModelResourceLocation itemModelResourceLocation = ChessboardModel.modelResourceLocation; IBakedModel existingModel = event.getModelRegistry().get(itemModelResourceLocation); if (existingModel == null) { LOGGER.warn("Did not find the expected vanilla baked model for ChessboardModel in registry"); } else if (existingModel instanceof ChessboardModel) { LOGGER.warn("Tried to replace ChessboardModel twice"); } else { ChessboardModel customModel = new ChessboardModel(existingModel); event.getModelRegistry().put(itemModelResourceLocation, customModel); } }
×
×
  • Create New...

Important Information

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