-
Content Count
139 -
Joined
-
Last visited
Community Reputation
8 NeutralAbout urbanxx001
-
Rank
Creeper Killer
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
[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?