added back attribute patches (#7886)

This commit is contained in:
Cyborgmas authored and GitHub committed 2021-07-24 16:30:21 +02:00
1 parent 695e1fbb94
commit 5af6649435
3 files changed
+22 -15

No files matched your search

@@ -1390,16 +1390,6 @@ public class ForgeHooks
return Collections.unmodifiableMap(FORGE_ATTRIBUTES);
}
/** FOR INTERNAL USE ONLY, DO NOT CALL DIRECTLY
* ONLY EXISTS FOR LEGACY REASONS SHOULD BE REMOVED IN 1.17
*/
@Deprecated /// Internal use only, Remove in 1.17
public static AttributeSupplier putAttributesOld(EntityType<? extends LivingEntity> type, AttributeSupplier map)
{
LOGGER.warn("Called deprecated GlobalEntityTypeAttributes#put for {}, use EntityAttributeCreationEvent instead.", type.getRegistryName());
return FORGE_ATTRIBUTES.put(type, map);
}
/** FOR INTERNAL USE ONLY, DO NOT CALL DIRECTLY */
@Deprecated
public static void modifyAttributes()
@@ -1410,10 +1400,10 @@ public class ForgeHooks
finalMap.forEach((k, v) ->
{
AttributeSupplier modifiers = DefaultAttributes.getSupplier(k);
AttributeSupplier.Builder newMutable = modifiers != null ? new AttributeSupplier.Builder(modifiers) : new AttributeSupplier.Builder();
newMutable.combine(v);
FORGE_ATTRIBUTES.put(k, newMutable.build());
AttributeSupplier supplier = DefaultAttributes.getSupplier(k);
AttributeSupplier.Builder newBuilder = supplier != null ? new AttributeSupplier.Builder(supplier) : new AttributeSupplier.Builder();
newBuilder.combine(v);
FORGE_ATTRIBUTES.put(k, newBuilder.build());
});
}
}
@@ -47,7 +47,7 @@ public class EntityAttributeCreationEvent extends Event implements IModBusEvent
public void put(EntityType<? extends LivingEntity> entity, AttributeSupplier map)
{
if (DefaultAttributes.hasSupplier(entity))
throw new IllegalStateException("Duplicate GlobalEntityTypeAttributes entry: " + entity);
throw new IllegalStateException("Duplicate DefaultAttributes entry: " + entity);
this.map.put(entity, map);
}
}