Fix #34.
This commit is contained in:
parent
7145a9c854
commit
5d1a28c33b
|
@ -93,7 +93,7 @@ public abstract class MobEntityMixin extends LivingEntityMixin implements MobEnt
|
||||||
this.aware = true;
|
this.aware = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private transient AtomicBoolean arclight$targetSuccess;
|
protected transient AtomicBoolean arclight$targetSuccess;
|
||||||
private transient EntityTargetEvent.TargetReason arclight$reason;
|
private transient EntityTargetEvent.TargetReason arclight$reason;
|
||||||
private transient boolean arclight$fireEvent;
|
private transient boolean arclight$fireEvent;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
@Mixin(EndermanEntity.class)
|
@Mixin(EndermanEntity.class)
|
||||||
public abstract class EndermanEntityMixin extends CreatureEntityMixin implements EndermanEntityBridge {
|
public abstract class EndermanEntityMixin extends CreatureEntityMixin implements EndermanEntityBridge {
|
||||||
|
@ -28,9 +29,16 @@ public abstract class EndermanEntityMixin extends CreatureEntityMixin implements
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public void setAttackTarget(@Nullable LivingEntity entity) {
|
public void setAttackTarget(@Nullable LivingEntity entity) {
|
||||||
if (!super.setGoalTarget(entity, EntityTargetEvent.TargetReason.UNKNOWN, true)) {
|
if (this.getAttackTarget() == entity) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.bridge$pushGoalTargetReason(EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||||
|
arclight$targetSuccess = new AtomicBoolean();
|
||||||
|
super.setAttackTarget(entity);
|
||||||
|
boolean ret = arclight$targetSuccess.get();
|
||||||
|
arclight$targetSuccess = null;
|
||||||
|
if (ret) {
|
||||||
bridge$updateTarget(getAttackTarget());
|
bridge$updateTarget(getAttackTarget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@ import io.izzel.arclight.common.bridge.bukkit.MaterialBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge;
|
import io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge;
|
||||||
import io.izzel.arclight.common.mod.ArclightMod;
|
import io.izzel.arclight.common.mod.ArclightMod;
|
||||||
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
||||||
import io.izzel.arclight.common.mod.util.potion.ArclightPotionEffect;
|
import io.izzel.arclight.common.mod.util.types.ArclightEnchantment;
|
||||||
|
import io.izzel.arclight.common.mod.util.types.ArclightPotionEffect;
|
||||||
import io.izzel.arclight.i18n.ArclightConfig;
|
import io.izzel.arclight.i18n.ArclightConfig;
|
||||||
import io.izzel.arclight.i18n.conf.EntityPropertySpec;
|
import io.izzel.arclight.i18n.conf.EntityPropertySpec;
|
||||||
import io.izzel.arclight.i18n.conf.MaterialPropertySpec;
|
import io.izzel.arclight.i18n.conf.MaterialPropertySpec;
|
||||||
|
@ -29,7 +30,6 @@ import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.craftbukkit.v.CraftCrashReport;
|
import org.bukkit.craftbukkit.v.CraftCrashReport;
|
||||||
import org.bukkit.craftbukkit.v.enchantments.CraftEnchantment;
|
|
||||||
import org.bukkit.craftbukkit.v.util.CraftMagicNumbers;
|
import org.bukkit.craftbukkit.v.util.CraftMagicNumbers;
|
||||||
import org.bukkit.craftbukkit.v.util.CraftNamespacedKey;
|
import org.bukkit.craftbukkit.v.util.CraftNamespacedKey;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
@ -167,7 +167,10 @@ public class BukkitRegistry {
|
||||||
int size = ForgeRegistries.ENCHANTMENTS.getEntries().size();
|
int size = ForgeRegistries.ENCHANTMENTS.getEntries().size();
|
||||||
putBool(Enchantment.class, "acceptingNew", true);
|
putBool(Enchantment.class, "acceptingNew", true);
|
||||||
for (Map.Entry<ResourceLocation, net.minecraft.enchantment.Enchantment> entry : ForgeRegistries.ENCHANTMENTS.getEntries()) {
|
for (Map.Entry<ResourceLocation, net.minecraft.enchantment.Enchantment> entry : ForgeRegistries.ENCHANTMENTS.getEntries()) {
|
||||||
Enchantment.registerEnchantment(new CraftEnchantment(entry.getValue()));
|
String name = ResourceLocationUtil.standardize(entry.getKey());
|
||||||
|
ArclightEnchantment enchantment = new ArclightEnchantment(entry.getValue(), name);
|
||||||
|
Enchantment.registerEnchantment(enchantment);
|
||||||
|
ArclightMod.LOGGER.debug("Registered {} as enchantment {}", entry.getKey(), enchantment);
|
||||||
}
|
}
|
||||||
Enchantment.stopAcceptingRegistrations();
|
Enchantment.stopAcceptingRegistrations();
|
||||||
ArclightMod.LOGGER.info("registry.enchantment", size - origin);
|
ArclightMod.LOGGER.info("registry.enchantment", size - origin);
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package io.izzel.arclight.common.mod.util.types;
|
||||||
|
|
||||||
|
import net.minecraft.enchantment.Enchantment;
|
||||||
|
import org.bukkit.craftbukkit.v.enchantments.CraftEnchantment;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class ArclightEnchantment extends CraftEnchantment {
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public ArclightEnchantment(Enchantment target, String name) {
|
||||||
|
super(target);
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String getName() {
|
||||||
|
String name = super.getName();
|
||||||
|
if (name.startsWith("UNKNOWN_ENCHANT_")) {
|
||||||
|
return this.name;
|
||||||
|
} else {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package io.izzel.arclight.common.mod.util.potion;
|
package io.izzel.arclight.common.mod.util.types;
|
||||||
|
|
||||||
import net.minecraft.potion.Effect;
|
import net.minecraft.potion.Effect;
|
||||||
import org.bukkit.craftbukkit.v.potion.CraftPotionEffectType;
|
import org.bukkit.craftbukkit.v.potion.CraftPotionEffectType;
|
|
@ -3,7 +3,7 @@ import java.nio.file.attribute.BasicFileAttributes
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group 'io.izzel.arclight'
|
group 'io.izzel.arclight'
|
||||||
version '1.0.3'
|
version '1.0.4-SNAPSHOT'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
agpVersion = '1.7'
|
agpVersion = '1.7'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user