-
Posts
200 -
Joined
-
Last visited
Everything posted by urbanxx001
-
The mob is complete and it spawns fine with an egg, but I'm having trouble spawning it in biomes. I've: Registered mob placement in the common startup event with: EntitySpawnPlacementRegistry.register(MY_MOB, EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, MyMobEntity::checkSpawnRules); With the following spawn rules: public static boolean checkSpawnRules(EntityType<? extends AnimalEntity> p_223325_0_, IServerWorld p_223325_1_, SpawnReason p_223325_2_, BlockPos p_223325_3_, Random p_223325_4_) { return p_223325_1_.getDifficulty() != Difficulty.PEACEFUL && MonsterEntity.isDarkEnoughToSpawn(p_223325_1_, p_223325_3_, p_223325_4_) && checkMobSpawnRules(p_223325_0_, p_223325_1_, p_223325_2_, p_223325_3_, p_223325_4_); } And added a method in a BiomeLoadingEvent that adds the spawn whenever an enderman is present in a biome's spawn list: @SubscribeEvent public static void onBiomeLoad(BiomeLoadingEvent event) { MobSpawnInfoBuilder spawns = event.getSpawns(); Set<EntityType<?>> entityTypes = spawns.getEntityTypes(); for (EntityType<?> entityType : entityTypes) { if (entityType == EntityType.ENDERMAN) { int weight = 10; if (event.getCategory() == Biome.Category.NETHER) { weight = 1; } spawns.addSpawn(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(ModEntities.MY_MOB, weight, 1, 4)); break; } } } I expected to see many of my mob roaming around the End. Any help is appreciated.
-
Ah ok I'm sorry to hear that. I dug a little and it appears if occlusion doesn't solve it, then it might be an issue with Forge's lighting engine and/or model loading, according to this issue thread. To summarize, the engine is particular about vertex ordering in the model, which means certain sides are incorrectly taking the lighting values that should be applied to other sides. The only thing I can suggest is enabling an experimental feature in Forge's config called experimentalForgeLightingPipelineEnabled.
-
The darkness is associated with ambient occlusion, in your block class you can modify this with: @Override public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos) { return (some float); } I've found that small values (usually around 0.1F) reduce the dark. Alternatively in your block model json you can disable or enable occlusion with: "ambientocclusion": true/false
-
I'm attempting to add a fire-like overlay to a mob when a certain condition is present. Nothing has crashed, but no overlay appears. The code is adapted for a RenderLivingEvent directly from the #renderEntityStatic method in EntityRendererManager. I don't believe the issue has to do with the texture stitching event, but I could be wrong. ModSubscribeEvents
-
I'll try to help, but the only type of Config I've written is a Common type, if this is something specific to Server type. Is this only happening after editing certain config options or any of them? Nothing appears wrong with the numerical range configs
-
[1.16.X] Forgot Method Is Static [Solved]
urbanxx001 replied to urbanxx001's topic in Modder Support
Ah you're right how did I miss that... thanks. Right now I'm creating a connected block using a custom blockstate property and several checks in #updatePostPlacement, however something about the loops I have is freezing the game after the 5th or 6th block of the same type, would try to remedy it with the aforementioned method but will seek a different solution. -
net.minecraft.client.entity.EntityPlayerSP not showing up [1.16.5]
urbanxx001 replied to peytoncl's topic in Modder Support
Hi, welcome to the Forum! It'll help if you post the full error log in a pastebin. It can be found in (mod folder root) > run > logs > latest.log. -
So it might have to do with the version that I'm using (1.16.1-32.0.108) but I'm unable to override the public method #getValidBlockforPosition in my custom block which extends the Block class. The issue has nothing to do with an unmapped name like func_12345. I could see if an AT makes a difference even though it's redundant?
-
So I'm probably overthinking this, but I have an itemstack with nbt and now it needs to be converted to an item to register for a villager trade. Normally this would be #getItem(), but that just returns the item type. Here it's recommended to override the methods associated with the context of the item's use, but that boils down to interacting with code that still uses itemstack. Edit: Nvm forgot my code for generating trades uses itemstacks directly, got it working with that.
-
[1.16.x] No Class TypeResolver Initialization Error
urbanxx001 replied to urbanxx001's topic in Support & Bug Reports
That did the trick! Thanks -
[1.16.x] No Class TypeResolver Initialization Error
urbanxx001 replied to urbanxx001's topic in Support & Bug Reports
Tried that, it still gives the error. Pretty bizarre. I might just try transferring all the code to a new gradle project. -
That makes a ton of sense now... it's strange that it's set like that though, if ImageButton has a constructor that accepts text, you would think it would render on the button by default. Normally it just passes StringTextComponent.field_240750_d_ (an empty string), so having another hurdle seems redundant.
-
I recommend taking a look at the Forge documentation for events. In your Main class, the mod event bus is added as: @Mod(Main.MOD_ID) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class Main { public static final String MOD_ID = "mod_id"; public Main() { final IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); eventBus.addListener(this::onCommonSetup); eventBus.addListener(this::onClientSetup); } private void onClientSetup(FMLClientSetupEvent event) { registerColors(); } } Alternatively, if you do the subscribe event, Poopoodice is saying you can get the colors from the event like: BlockColors blockcolors = event.getBlockColors();
-
One way to add Biome colors to blocks is by registering directly in the client proxy. A few different examples below. In your case, the example with the oak hedge will let your block change with biome, and change getFoliageColor() to getWaterColor(). private void registerColors() { BlockColors blockcolors = Minecraft.getInstance().getBlockColors(); ItemColors itemcolors = Minecraft.getInstance().getItemColors(); blockcolors.register((state, world, pos, tintIndex) -> 12665871, ModBlocks.HEDGE_RED_MAPLE); blockcolors.register((state, reader, pos, i) -> FoliageColors.getSpruce(), ModBlocks.SPRUCE_LEAF_CARPET, ModBlocks.HEDGE_SPRUCE); blockcolors.register((state, reader, pos, i) -> reader != null && pos != null ? BiomeColors.getFoliageColor(reader, pos) : FoliageColors.getDefault(), ModBlocks.OAK_LEAF_CARPET, ModBlocks.HEDGE_OAK, itemcolors.register((stack, i) -> { BlockState state = ((BlockItem)stack.getItem()).getBlock().getDefaultState(); return blockcolors.getColor(state, null, null, i); }, ModBlocks.OAK_LEAF_CARPET, ModBlocks.HEDGE_OAK, ModBlocks.SPRUCE_LEAF_CARPET, ModBlocks.HEDGE_SPRUCE, ModBlocks.HEDGE_RED_MAPLE); }
-
So this seems like a bug, but it could be a drawing issue I'm not aware of. I have an ImageButton and regular Button: this.func_230480_a_(new ImageButton(xstart + 99, ystart + 18, 70, 16, 156, 0, 21, WIDGET_TEXTURES, 256, 256, (p_213070_1_) -> { }, new TranslationTextComponent("Image Button"))); this.func_230480_a_(new Button(xstart + 99, ystart + 18, 70, 20, new TranslationTextComponent("Button"), (p_213070_1_) -> { })); Both textures render fine, however the ImageButton doesn't display text. This is odd considering they both output the same arguments below. I also tried to give the ImageButton text color to see if it would make a difference, but it doesn't. TranslatableComponent{key='Image Button', args=[], siblings=[], style=Style{ color=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null, font=minecraft:default}} TranslatableComponent{key='Button', args=[], siblings=[], style=Style{ color=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null, font=minecraft:default}}
-
Yeah toggling the visibility is an option. However this is usually only possible by clicking on the button, which can't be done in this case. Now that I think about it, the game rule menu for creating a world has scrolling buttons, I’ll take a look there. Edit: ok I didn't realize you could access the widgets with this.field_230710_m_ ..smh these auto-generated names.
-
The condition is from a scrollbar. I can do changes there, however I don't what actual methods exist to either remove or update the buttons.
-
You could try "Invalidate Caches/Restart" under File.
-
According to several sources, it's difficult to update widgets when you're not directly clicking/interacting with them. In my case I'd like to change the text displayed by buttons. I've considered a few solutions. One is to call drawing events in GuiScreenEvent to get the widgets and replace them. However these events are only called when the screen is instantiated. Another is to use the updateScreen() method in the custom screen class, however I can't seem to find it so I believe I'm not calling it correctly or it's deprecated. Finally I could manually close and reopen the screen with updated fields for the buttons, but this seems expensive.
-
[1.16.x] Get Entity from Wildcard EntityType
urbanxx001 replied to urbanxx001's topic in Modder Support
Thank you so much, I'll use GlobalEntityTypeAttributes then. The EntityType (a set of them actually) isn't being grabbed from an Entity in the world, but instead from the ForgeRegistry. It's being used for a database. I may still need the actual class, as I need to check if IAngerable is extended by it (to determine if mobs are Neutral or not; isPeacefulCreature only checks if the mob is peaceful or hostile). -
I see that lol. Unfortunately it seems like the crash report makes no reference to a specific mod, unless I overlooked it. You may have to remove the mods one by one to see where the trouble lies.
-
For an EntityType<?> I can use getClass(), but the methods available are generic, since it's a wildcard. I would like the specific entity class in order to retrieve attributes and check a few other data. Since methods like getAttribute() aren't directly available, this can (probably?) be accomplished with: if (MobEntity.class.isAssignableFrom(entityType.getClass())) { EntityType<? extends MobEntity> entityType1 = (EntityType<? extends MobEntity>) entityType; AttributeModifierMap.MutableAttribute attributeMap = null; Method[] methods = entityType1.getClass().getMethods(); for (Method method : methods) { if (method.getReturnType() == AttributeModifierMap.MutableAttribute.class) { attributeMap = (AttributeModifierMap.MutableAttribute) method.getDefaultValue(); } } } However this seems over-complicated. Alternatively I can cast ? to type T with a helper method, and then would somehow need to instantiate it: T entity = new T(entityType1, world) {}; But obviously T can't be used in that manner. Am I overthinking this?