Fix cocoon render being offset, change pixie spawn chance attribute registration location again.

This commit is contained in:
Vincent Lee committed 2020-03-22 19:59:06 -05:00
1 parent 2399745ff1
commit 68048891d7
2 files changed
+6 -4

No files matched your search

@@ -41,7 +41,6 @@ public class RenderTileCocoon extends TileEntityRenderer<TileCocoon> {
}
ms.push();
ms.translate(0, 0, 1);
ms.translate(0.5, 0, 0);
ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(rot));
ms.translate(-0.5, 0, 0);
@@ -8,6 +8,7 @@
*/
package vazkii.botania.common.core.handler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.attributes.AbstractAttributeMap;
@@ -22,6 +23,7 @@ import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -63,10 +65,11 @@ public final class PixieHandler {
return new AttributeModifier(DEFAULT_MODIFIER_UUIDS.get(slot), name, amount, AttributeModifier.Operation.ADDITION);
}
// Want to do this as early as possible -- doing it at entity join world means attribute modifiers are ignored when loading
@SubscribeEvent
public static void playerJoin(EntityJoinWorldEvent evt) {
if (evt.getEntity() instanceof PlayerEntity) {
AbstractAttributeMap attributes = ((PlayerEntity) evt.getEntity()).getAttributes();
public static void registerAttribute(AttachCapabilitiesEvent<Entity> evt) {
if (evt.getObject() instanceof PlayerEntity) {
AbstractAttributeMap attributes = ((PlayerEntity) evt.getObject()).getAttributes();
if (attributes.getAttributeInstance(PIXIE_SPAWN_CHANCE) == null) {
attributes.registerAttribute(PIXIE_SPAWN_CHANCE);
}