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

urbanxx001

Members
  • Posts

    181
  • Joined

  • Last visited

Posts posted by urbanxx001

  1. On 5/24/2021 at 6:02 PM, Rinjikii said:

    I am trying to create a Solo Leveling Mod, and I started now and I am trying to learn, I am having little trouble understanding minecraft packages if you can help me I would appreciate it

    Hi Rinjikii, packages are essentially the same as folder directories that you'd use on your computer. When creating your mod you'll place your java files in packages, while your resources, which contains blockstates, textures, etc., uses folders. Once you have the conventional directory com.author_name.mod_name, the package structure is up to you.

  2. 7 hours ago, Arealcoder said:

    I'm making a block that mines blocks but right now you cant get the blocks it has ben mined

    Within the method that performs the mining action you can find a list of ItemEntities mined with getEntitiesWithinAABB() of the block's position, and filter to only find dirt, stone, etc. Once you have the entities you can teleport them to the block position above the mining block with teleportTo() or something similar.

  3. 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.

  4. 2 hours ago, Boy132 said:

    Thank you for your answer! Sadly none of that worked for me, I tried it with 0f, 0.05f, 0.1f and 0.2f (and editing the model json) and the result were the same as before.

    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.

     

    • Thanks 1
  5. 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

     

  6. 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

  7. 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

    • Like 1
  8. 36 minutes ago, poopoodice said:

    It's a static method 😛

    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. 

  9. 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? 

  10. 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.

  11. 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.

    • Like 1
  12. 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();
  13. 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);
    
    }
  14. 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}}
    
  15. 9 hours ago, vemerion said:

    iterate through that list and update the buttons when you want to perform the update.

    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.

×
×
  • Create New...

Important Information

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