TheGreyGhost
Members-
Posts
3280 -
Joined
-
Last visited
-
Days Won
8
Everything posted by TheGreyGhost
-
How to make entity look at another entity
TheGreyGhost replied to fernthedev's topic in Modder Support
Howdy When I've had similar trouble before, I've found it very useful to do a few different troubleshooting things 1) Kill off all entities except the one I'm testing and prevent any more from spawning, then using breakpoints (eg see this class https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/usefultools/debugging/DebugSpawnInhibitor.java 2) Add code to the tick event which prints the relevant variables to the console, including whether the tick is on client or server thread 3) breaking the problem into small steps (i.e. just doing the yaw, just pointing the head in a desired direction, pointing the head at a particular point, etc) Some problems I've had before 1) The units of rotation (degrees vs radians vs 1/256 of a circle) 2) mixing up the different head rotations - see here http://greyminecraftcoder.blogspot.com/2015/07/entity-rotations-and-animation.html (out of date but the concepts are still correct) -TGG -
[Forge 1.14] Where are the config classes?
TheGreyGhost replied to lizzyd710's topic in Modder Support
Howdy I think that has been removed. The classes that were previously used to construct a Gui for your config have been removed (last saw them in 1.12.2). I think you'll need to code your own custom Screen to present the config options. ModListScreen is the one used for the list of mods, see ::displayModConfig() for the code which calls the mod's custom GUI. Or you could port the relevant classes from 1.12.2 (IModGuiFactory, GuiConfig). -TGG -
[1.15.2] Getting a block's color for minimap
TheGreyGhost replied to FlashHUN's topic in Modder Support
Yeah I think you're right about BlockState#getMaterialColor. But I had assumed that the @deprecated are put there by MCP not by Mojang? Do annotations survive the obfuscation process? (Given that I've never seen any vanilla code using reflection) -
[1.15.2] [SOLVED] thrown object is not appearing
TheGreyGhost replied to robert135's topic in Modder Support
Hi Probably you are missing the registration of a suitable renderer for your entity? see EntityRendererManager- this.register(EntityType.SNOWBALL, new SpriteRenderer<>(this, itemRendererIn)); -TGG -
1.15 basic chest type container on client side only
TheGreyGhost replied to M1ntcraft3r's topic in Modder Support
Hi This tutorial has two examples of Screens (for containers, but the concepts are the same). https://github.com/TheGreyGhost/MinecraftByExample -see mbe30 ContainerScreenBasic and mbe31 ContainerScreenFurnace Cheers TGG -
Hi isOpaqueCube, isFullBlock, isFullCube are gone now. You specify a VoxeShape instead, and Minecraft figures those properties out by itself. http://greyminecraftcoder.blogspot.com/2020/02/block-shapes-voxelshapes-1144.html The corner getting darker looks a lot like the AmbientOcclusion calculations going wrong. This link has the basic concepts (method names etc out of date but the concepts are still relevant) http://greyminecraftcoder.blogspot.com/2014/12/lighting-18.html I did read a post a while ago that the ambient occlusion calcs in minecraft assume a certain vertex order on the faces. They also assume faces that point east, west, north, south, up, or down (i.e. not at an angle like yours). I'm not sure how to fix that, unfortunately. You might need to turn ambient occlusion off (I think that turning off detectCullableFaces flag in your model file might help with that - but I am not sure). Otherwise you'll need to trace into the rendering code and see how it is manipulating your face' vertex information- this might quite possibly cause you serious head damage based my own attempts at trying to understand what happens in that code. If you crack it please let me know? -! Cheers TGG
-
[Closed] Create a potion without Splash or Lingering variants
TheGreyGhost replied to BlockyPenguin's topic in Modder Support
Hi. Have a look through VanillaBrewingRecipe (Forge extension) and BrewingStandTileEntity (vanilla code) -TGG -
Yes... in most cases.. You can use animated textures for blocks eg similar to lava; the shape of the block doesn't change, just the texture on it. In that case, no TER required. You may sometimes need to use TER for non-animated shapes if you have unusual shapes (not made of cuboid) or unusual rendering modes (or, I think, multiple rendering modes within one block eg part opaque and part translucent... although I'm still figuring that one out). Otherwise yes, animated = TER, not animated = non-TER -TGG
-
[1.15.2] Questions regarding the overhead of tickable tile entities
TheGreyGhost replied to DavidM's topic in Modder Support
Hi The best piece of advice I can give is: code it the easy way, then stress test its performance. I'm betting that even ticking hundreds or thousands of pipes is not going to drag down the game performance by a noticeable margin. Although you could build a parallel data structure to record the pipe network, I wouldn't recommend doing that unless really necessary because it's harder to code and maintain, and keeping the data structure current (detecting all changes) could be quite difficult to get right due to chunks loading in and out. Your idea of a fast exit tick if not next to a chest is a good one I think, because it would be fairly simple to implement. There are several methods for blocks that are fired whenever the neighbour is updated, so a pipe can easily keep track of whether it's next to a chest. You wouldn't even need a TileEntity, a block with three blockstates (start, middle, end) is probably enough if you use scheduled ticking. When your "I'm next to a chest" tick occurs and discovers that the chest has an item in it, it can then hunt its way through the pipe network to find the chest at the other end; given this is very infrequent I can't imagine it would be a big burden. -TGG -
[1.15.2] Getting a block's color for minimap
TheGreyGhost replied to FlashHUN's topic in Modder Support
Howdy based on FilledMapItem::updateMapData and BlockColors::getColorOrMaterialColor, I think you should just use World and not mess with Chunk. It's ok to call BlockState::getMaterialColor. Don't worry too much about the @deprecated, they are sprinkled throughout the code and usually don't actually mean anything relevant (sometimes they are suggesting a more-flexible alternative but it's nearly always fine to ignore them.) Cheers TGG -
Howdy You could make your own copy of OBJmodel and OBJloader, change your obj file's extension to (eg) ".myo", and add it to ModelLoaderRegistry. This example shows object model loading, it may help? https://github.com/TheGreyGhost/MinecraftByExample see mbe21; class RenderWavefrontObj and models/block/mbe21_ter_wavefront_model.json -TGG
-
Hi Tikaji You might get some inspiration from looking at this working tutorial project https://github.com/TheGreyGhost/MinecraftByExample see mbe21 -TGG
-
Hi Ronaldi Yes it's possible, although I've never done it. You can add your own crafting recipe code to the game (by implementing IRecipe or ICraftingRecipe) which treats the NBT appropriately. Based on a quick glance at vanilla, you may need a corresponding IRecipeSerializer as well, to handle reading a recipe json. I don't know details of how to register a new recipe type, I suspect it will be the same style as @SubscribeEvent public static void onBlocksRegistration(final RegistryEvent.Register<Block> blockRegisterEvent) { but for RegistryEvent.Register<IRecipeSerializer<?>> There is some bare bones forge docs here about recipes, it might have some extra clues although there's also a good chance it's out of date unfortunately. https://mcforge.readthedocs.io/en/1.14.x/utilities/recipes/ -TGG
-
Hi You might find this example useful as well https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample (mbe50) Contains some extra information on how to use particles properly -TGG
-
Hi Here's a working example of how to add NBT to an item, might give you some inspiration on how to do it for your air tank. https://github.com/TheGreyGhost/MinecraftByExample/ mbe12, mbe11 -TGG
-
Well after a lot more digging I figured it out- it doesn't exist any more. There functions for reading from config files, but the mod config screen button just loads a normal Screen now, no automatically-constructing gui builder any more.
-
Hi You might find these links useful https://github.com/TheGreyGhost/MinecraftByExample (see mbe20) - working example of tile entity synchronisation and http://greyminecraftcoder.blogspot.com/2015/01/tileentity.html (a bit outdated but still current I think) -TGG
- 1 reply
-
- 1
-
Hi Good news! you can do all of that in the json blockstates now. https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a -TGG
- 1 reply
-
- 1
-
Howdy folks Does anyone know how the mod config screen is intended to be coded in 1.15.2? It seems to have changed quite a bit. After half an hour of googling I'm still not sure what the "forge approved" method is supposed to be now. Cheers TGG
-
Can't find proper event for creating models and blockstates
TheGreyGhost replied to Rackham's topic in Modder Support
Hi This working example project will show you which events to use as well as how to register them properly, and how to match the registry name to the location of the blockstate and models. https://github.com/TheGreyGhost/MinecraftByExample Try mbe01 as a starting point Cheers TGG -
Hi One way that I know for sure will work is to use a TileEntityRenderer. This has its own render code so you can render whichever textures you want, in whichever order you want, and also control the shading directly if necessary. An example of how to use a TER is here (mbe21) https://github.com/TheGreyGhost/MinecraftByExample Render the opaque first, using SOLID, then render the translucent using TRANSPARENT. -TGG