• Recently Browsing

    No registered users viewing this page.

  • Posts

    • It appears that this requires both `RenderSystem.disableDepthTest()` and `RenderSystem.depthMask(false)`.   
    • Why did you copy-paste that class? That does not make any sense. Just register your condition to the registry in FMLCommonSetupEvent and use DeferredWorkQueue since the registry is not threadsafe. You do not need CorruptionLootConditionManager at all.
    • I have been trying to use a GlobalLootModifer to add a new item to the Strider's loot table. However, since it seems as there is no existing loot condition that checks the type of entity (minecraft:strider), it adds my item as a possible drop off of any entity. Because of this, I am trying to make my own LootCondition that checks the entity type, but the problem is that I get a message that says minecraft:entity_slain is unrecognized when it parses my JSON file. I believe this is because it is being registered improperly. Forge doesn't have a registry for LootConditionType so I had to use the vanilla one but is still won't work. If anyone has a solution OR an alternative I would greatly appreciate it! Here's the code: JSON { "type":"corruption:strider_socks", "conditions": [ { "condition":"minecraft:random_chance_with_looting", "chance":0.5, "looting_multiplier":0.2 }, { "condition": "minecraft:entity_slain", "entity":"minecraft:strider" } ], "item": "corruption:lava_waders" } CorruptionLootConditionManager: package com.enderunknown.corruption.util.loot; import java.util.function.Predicate; import net.minecraft.loot.ILootSerializer; import net.minecraft.loot.LootConditionType; import net.minecraft.loot.LootTypesManager; import net.minecraft.loot.conditions.ILootCondition; import net.minecraft.util.ResourceLocation; import net.minecraft.util.registry.Registry; public class CorruptionLootConditionManager { public static final LootConditionType ENTITY_SLAIN = func_237475_a_("entity_slain", new EntitySlain.Serializer()); private static LootConditionType func_237475_a_(String p_237475_0_, ILootSerializer<? extends ILootCondition> p_237475_1_) { return Registry.register(Registry.field_239704_ba_, new ResourceLocation(p_237475_0_), new LootConditionType(p_237475_1_)); } public static Object func_237474_a_() { return LootTypesManager.func_237389_a_(Registry.field_239704_ba_, "condition", "condition", ILootCondition::func_230419_b_).func_237395_a_(); } public static <T> Predicate<T> and(Predicate<T>[] p_216305_0_) { switch(p_216305_0_.length) { case 0: return (p_216304_0_) -> { return true; }; case 1: return p_216305_0_[0]; case 2: return p_216305_0_[0].and(p_216305_0_[1]); default: return (p_216307_1_) -> { for(Predicate<T> predicate : p_216305_0_) { if (!predicate.test(p_216307_1_)) { return false; } } return true; }; } } public static <T> Predicate<T> or(Predicate<T>[] p_216306_0_) { switch(p_216306_0_.length) { case 0: return (p_216308_0_) -> { return false; }; case 1: return p_216306_0_[0]; case 2: return p_216306_0_[0].or(p_216306_0_[1]); default: return (p_216309_1_) -> { for(Predicate<T> predicate : p_216306_0_) { if (predicate.test(p_216309_1_)) { return true; } } return false; }; } } } EntitySlain ILootCondition: package com.enderunknown.corruption.util.loot; import java.util.Set; import com.google.common.collect.ImmutableSet; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.loot.ILootSerializer; import net.minecraft.loot.LootConditionType; import net.minecraft.loot.LootContext; import net.minecraft.loot.LootParameter; import net.minecraft.loot.LootParameters; import net.minecraft.loot.conditions.ILootCondition; import net.minecraft.util.JSONUtils; import net.minecraft.util.ResourceLocation; import net.minecraft.util.registry.Registry; public class EntitySlain implements ILootCondition { private final EntityType<?> entityType; public EntitySlain(EntityType<?> entityType) { this.entityType = entityType; } public LootConditionType func_230419_b_() { return CorruptionLootConditionManager.ENTITY_SLAIN; } public Set<LootParameter<?>> getRequiredParameters() { return ImmutableSet.of(LootParameters.THIS_ENTITY); } public boolean test(LootContext context) { Entity entity = context.get(LootParameters.THIS_ENTITY); return entity != null && this.entityType.getTags() == entity.getType().getTags(); } public static class Builder implements ILootCondition.IBuilder { private final EntityType<?> entity; public Builder(EntityType<?> entityIn) { this.entity = entityIn; } public ILootCondition build() { return new EntitySlain(this.entity); } } public static class Serializer implements ILootSerializer<EntitySlain> { public void func_230424_a_(JsonObject p_230424_1_, EntitySlain p_230424_2_, JsonSerializationContext p_230424_3_) { p_230424_1_.addProperty("entity", Registry.ENTITY_TYPE.getKey(p_230424_2_.entityType).toString()); } public EntitySlain func_230423_a_(JsonObject p_230423_1_, JsonDeserializationContext p_230423_2_) { ResourceLocation resourcelocation = new ResourceLocation(JSONUtils.getString(p_230423_1_, "entity")); EntityType<?> entityT = Registry.ENTITY_TYPE.getValue(resourcelocation).orElseThrow(() -> { return new IllegalArgumentException("Can't find block " + resourcelocation); }); return new EntitySlain(entityT); } } } Thanks!
    • Yes, player motion is not known on the server.
  • Topics

  • Who's Online (See full list)