Jump to content

Sinu

Members
  • Posts

    29
  • Joined

  • Last visited

Posts posted by Sinu

  1. Sweet, that seems to have worked!
    The one issue is that, I had to check if the instance was client or server because for some reason the server kept thinking the light level of the player is always 0 (is it client-side only?). So my code looks like this now:

    PlayerEntity player = event.player;
    		World world = event.player.level;
    		BlockPos blockpos = player.blockPosition();
    		BlockState block = world.getBlockState(blockpos);
    		
    		if (world.isClientSide)
    		{
    			System.out.print(world.getMaxLocalRawBrightness(blockpos) + System.lineSeparator());
    			if (world.getMaxLocalRawBrightness(blockpos) == 0)
    			{
    				((LivingEntity)event.player).addEffect(new EffectInstance(Effects.BLINDNESS, 20, 3));	
    			}
    		}

    But now once I walk out of the light level of 0, it still says that I have the Blindness effect even though I can see clearly. I am assuming that since I checked if the instance is client-side or not, it didn't actually give the potion effect according to the server (which makes sense) but I don't understand why Blindness goes away even after I walk into the light?

  2. I am trying to give a blinding effect to players who are in light level of 0 but I can't seem to get it to work.

    @SubscribeEvent
        public static void onPlayerTick(TickEvent.PlayerTickEvent event)
        {
    		PlayerEntity player = event.player;
    		World world = event.player.level;
    		BlockPos blockpos = player.blockPosition();
    		BlockState block = world.getBlockState(blockpos);
    		
    		if (block.getLightValue(world, blockpos) == 0 && block != null)
    		{
    			((LivingEntity)event.player).addEffect(new EffectInstance(Effects.BLINDNESS, 20, 3));
    		}
        }

    Am I using getLightValue correctly? Also I am correctly feeding in the correct block position?

  3. Do you mean that I am putting Forge as my dependency and setting "ordering" to AFTER? If so, would it look like this?

    [[dependencies.forge]]
        modId="forge"
        mandatory=true
        versionRange="[36,)"
        ordering="NONE"
        side="BOTH"

    (not 100% sure how to reference Forge as my dependency. Assuming it's just "dependencies.forge")

  4. I've been trying to remove several vanilla recipes and realized the ones I am trying to remove don't work because they use tags by Forge.
    For example, I can easily remove the Melon recipe but I can't remove Fishing Rod recipe.

    I copied over the file from vanilla datapack and put it in data.minecraft.recipes with the same naming format (for example: melon.json or fishing_rod.json) and changed the output to air and it does not work for the Fishing Rod recipe. This is also true for other recipes that use tags by Forge.

    I also read this forum post from a while back:

    But I am not understanding how this user was able to replace Forge recipes.
    Here is vanilla fishing_rod.json file: https://hatebin.com/zqhejklbgm
    Here is my fishing_rod.json file put in data.minecraft.recipes: https://hatebin.com/quqkzvlrhj

  5. Actually I figured it out. Instead of doing SubscribeEvent, I just registered it to my main method with: 

    FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);

    private void doClientStuff(FMLClientSetupEvent event) {
    		event.enqueueWork(() ->
    		{
    			ItemModelsProperties.register(BrimheimItems.COIN_BRONZE.get(), 
    				new ResourceLocation(Brimheim.MODID, "stack"), (stack, world, entity) -> {
    	        return stack.getCount();
    	        });
    		});
        }

     

  6. I think I got a hang of what I should be doing but I think I am doing something wrong.
    My json file looks like this which I think is correct:

    {
    	"parent": "item/generated",
    	"textures": {
    		"layer0": "brimheim:items/coin_bronze"
    	},
    	"overrides": [
    		{
    			"predicate": {
    				"brimheim:stack": 16
    			},
    			"model": "brimheim:item/coin_bronze_stack"
    		},
    		{
    			"predicate": {
    				"brimheim:stack": 32
    			},
    			"model": "brimheim:item/coin_bronze_bag"
    		}
    	]
    }

    and this is my FMLClientSetupEvent event:

    @Mod.EventBusSubscriber(modid = Brimheim.MODID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
    public class BrimheimClient
    {
    	@SubscribeEvent
    	public void setModelProperties(final FMLClientSetupEvent event)
    	{
    		event.enqueueWork(() ->
    		{
    			ItemModelsProperties.register(BrimheimItems.COIN_BRONZE.get(), 
    				new ResourceLocation(Brimheim.MODID, "stack"), (stack, world, entity) -> {
    	        return stack.getCount();
    	        });
    		});
    	}
    }

    Also, I am not sure if the event method should be public or private. When I had it on private, I had a java.lang.RuntimeException: Illegal private member with @SubscribeEvent annotation error.

  7. Where can I find where Forge references the bow to change it's texture? Or does the bow implement it's features differently than the way you explained it? Looking at example codes help me learn the best I think.

    EDIT: Oh, I think I understand what you mean. I found https://mcforge.readthedocs.io/en/latest/models/overrides/ which seems pretty close to what I want. So from what I am understanding, I am defining a new "predicate" for the item to recognize within the json file?

    My next question is, where do I insert the FMLClientSetupEvent event?
    I figured out where to put it! I have trouble editing this line to have it reflect with the number of stacks:
    return entity != null && stack.getCount() && entity.getActiveItemStack() == stack ? 1.0F : 0.0F;

    I am assuming I don't need to check if entity is null or not but only have it register the number of item stack?

  8. After some testing, I have found the mod that is somehow causing this issue. It was Realistic Torches mod. I am running Realistic Torches 3.1.2 for Minecraft 1.16.5 on Forge 1.16.5-36.1.18. Does anyone know if there is a solution for this?

    I also noticed that this is not entirely a world generation issue. I tried middle-mouse clicking each block that are broken and placing them back down and somehow the game places a new broken block? Each time I middle-mouse click the new broken block, it keeps giving me a whole new broken block. I have never seen this kind of bug before. Does anyone know why this could be happening?

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.