- 最后登录:
- -
- 阅读权限:
- 25
- 主题数:
- 1
- 总积分:
- 1614
- 回帖数:
- 12
- 精华数:
- 0
-
EU:0
RF:1598
Vis:0
Mana:0
AE:32
|
这样就行了
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE)
public class CloneEvent {
@SubscribeEvent
public static void clone(PlayerEvent.Clone event){
if(event.isWasDeath()) return;
PlayerEntity old = event.getOriginal();
PlayerEntity newPlayer = (PlayerEntity) event.getEntity();
for(ResourceLocation resourceLocation : ForgeRegistries.ATTRIBUTES.getKeys()){
if(old.getAttribute(ForgeRegistries.ATTRIBUTES.getValue(resourceLocation)) != null){
for (AttributeModifier a : old.getAttribute(ForgeRegistries.ATTRIBUTES.getValue(resourceLocation)).getModifiers()){
newPlayer.getAttribute(ForgeRegistries.ATTRIBUTES.getValue(resourceLocation)).addPermanentModifier(a);
}
}
}
for(EffectInstance effectInstance : old.getActiveEffects()){
newPlayer.forceAddEffect(effectInstance);
}
}
}
|
|