- 128
- 12
Решил я значит сделать меч, который при ломании взрывается, вроде всё вышло, даже AlexSocol помог доработать, но теперь столкнулся с проблемой - НИЧЕГО не работает, взрыв просто НЕТ. Что мне делать?
Зарегистрировал в главном классе так:
Код:
package com.example.examplemod;
import java.util.List;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.divinerpg.utils.TooltipLocalizer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
public class ebonsword<PlayerDestroyItem> extends ItemSword{
private static final String world = null;
private float witherSeconds;
private float regenerationSeconds;
private float zalupaseconds;
private float huiseconds;
private float p_70060_1_;
private float p_70060_2_;
private float p_70060_3_;
private double p_72876_2_;
private double p_72876_4_;
private double p_72876_6_;
private float p_72876_8_;
private boolean p_72876_9_;
public ebonsword() {
super(Mybestmod.MADINIT);
this.setCreativeTab(CreativeTabs.tabCombat);
this.setTextureName("blockj:RSW");
this.witherSeconds = 5;
this.regenerationSeconds = 5;
this.huiseconds = 5;
}
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
if(entity instanceof EntityLivingBase)((EntityLivingBase)player).addPotionEffect(new PotionEffect(Potion.regeneration.id, (int)(regenerationSeconds*20), 8));
if(entity instanceof EntityLivingBase)((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.wither.id, (int)(witherSeconds*5), 120));
if(entity instanceof EntityLivingBase)((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.hunger.id, (int)(witherSeconds*5), 120));
if(entity instanceof EntityLivingBase)((EntityLivingBase)player).addPotionEffect(new PotionEffect(Potion.field_76443_y.id, 20, 4));
return false;
}
protected void addAdditionalInformation(List list) {
list.add(TooltipLocalizer.regen(this.regenerationSeconds));
list.add(TooltipLocalizer.wither(this.witherSeconds));
list.add(TooltipLocalizer.hunger(this.huiseconds));
list.add(TooltipLocalizer.satur(this.zalupaseconds));
}
@SubscribeEvent
public void onPlayerDestroyItem(PlayerDestroyItemEvent e) {
if (e.original.getItem() == Mybestmod.ebonsword)
e.entityPlayer.worldObj.createExplosion(
e.entityPlayer, e.entityPlayer.posX, e.entityPlayer.posY,
e.entityPlayer.posZ, 10.0F, true);
}
}
Зарегистрировал в главном классе так:
Код:
@EventHandler
public void preLoad(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
{