- 15
- 0
Здравствуйте, ай стьюпид, соу мне нужна помощь. Не могу зарендерить косу чтобы она была соу биг.
Код:
package ru.gorodilov.baramod.items.weapons;
import org.lwjgl.opengl.GL11;
import ru.gorodilov.baramod.model.model_ruby_gun;
import ru.gorodilov.baramod.model.model_ruby_scythe;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
public class ScytheRenderer implements IItemRenderer {
protected model_ruby_scythe ScytheModel = new model_ruby_scythe();
protected model_ruby_gun GunModel = new model_ruby_gun();
public ScytheRenderer() {
ScytheModel = new model_ruby_scythe();
GunModel = new model_ruby_gun();
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch (type) {
case EQUIPPED:
return true;
default:
return false;
}
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return false;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch (type) {
case EQUIPPED: {
GL11.glPushMatrix();
if (data[1] != null && data[1] instanceof EntityPlayer) {
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("arima:textures/items/weapons/Scythes/ruby_scythe_2.png"));
if (Scythes.get_Crescent_Rose_State(item)) {
GL11.glRotatef(100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-150.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-95.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.1F, -0.75F, -0.1F);
this.GunModel.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
} else {
GL11.glRotatef(80.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-40.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.1F, -0.5F, -0.7F);
this.ScytheModel.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
}
} else {
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("arima:textures/items/weapons/Scythes/ruby_scythe_2.png"));
GL11.glRotatef(80.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-40.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.1F, -0.5F, -0.7F);
this.ScytheModel.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
}
GL11.glPopMatrix();
}
default:
break;
}
}
}
Код:
package ru.gorodilov.baramod.items.weapons;
import java.util.List;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ru.gorodilov.baramod.AllItems;
import ru.gorodilov.baramod.Main;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
public class Scythes extends ItemSword {
final Random random = new Random();
private int weaponDamage;
private String ScytheName;
public Scythes(ToolMaterial material, String texture, String name) {
super(AllItems.ScytheMat);
this.setCreativeTab(CreativeTabs.tabCombat);
this.setTextureName(texture);
this.setMaxDamage(-1);
this.setUnlocalizedName(name);
this.ScytheName = name;
this.setFull3D();
this.weaponDamage = 50 + random.nextInt(60);
GameRegistry.registerItem(this, name);
}
@Override
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
return 72000;
}
public static boolean get_Crescent_Rose_State(ItemStack itemstack) {
return itemstack.hasTagCompound() ? itemstack.getTagCompound().getBoolean("Crescent_Rose") : false;
}
public static void set_Crescent_Rose_State(ItemStack itemstack, boolean flag) {
if (!itemstack.hasTagCompound()) {
itemstack.setTagCompound(new NBTTagCompound());
}
itemstack.getTagCompound().setBoolean("Crescent_Rose", flag);
}
public int getDamageVsEntity(Entity par1Entity) {
return this.weaponDamage;
}
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
return EnumAction.bow;
}
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
set_Crescent_Rose_State(stack, true);
}
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
int i = 1 + random.nextInt(10);
int x = 1 + random.nextInt(3);
if (i == 10 || i == 9) {
player.worldObj.playSoundAtEntity(player, "bar:Coup_de_Grace", 0.8F, 1.0F);
this.weaponDamage = 70 + (random.nextInt(30));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.id, 200));
} else {
this.weaponDamage = 45 + random.nextInt(15);
player.worldObj.playSoundAtEntity(player, "bar:scythe_hit_" + x + "_", 0.2F, 1.0F);
}
return false;
}
@Override
public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer player, int p_77615_4_) {
int j = this.getMaxItemUseDuration(p_77615_1_) - p_77615_4_;
ArrowLooseEvent event = new ArrowLooseEvent(player, p_77615_1_, j);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled()) {
return;
}
j = event.charge;
boolean flag = player.capabilities.isCreativeMode;
if (flag || player.inventory.hasItem(AllItems.bullet)) {
p_77615_2_.playSoundAtEntity(player, "bar:rwby", 0.7F, 0.95F);
Vec3 look;
EntityArrow fireball;
look = player.getLookVec();
player.motionX = -look.xCoord / 1.5D;
player.motionZ = -look.zCoord / 1.5D;
player.motionY = -look.yCoord / 1.5D;
player.motionX = -look.xCoord / 1.5D;
player.motionZ = -look.zCoord / 1.5D;
if (!p_77615_2_.isRemote) {
fireball = new EntityArrow(p_77615_2_, player, 5.0F);
fireball.canBePickedUp = 0;
if (!player.capabilities.isCreativeMode) {
player.inventory.consumeInventoryItem(AllItems.bullet);
}
p_77615_2_.spawnEntityInWorld(fireball);
p_77615_1_.damageItem(1, player);
}
set_Crescent_Rose_State(p_77615_1_, false);
} else {
set_Crescent_Rose_State(p_77615_1_, false);
}
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
p_77624_3_.add("\u00a79\u0423\u0440\u043e\u043d 45-60");
p_77624_3_.add(
"\u00a79\u0417\u0430\u0436\u0430\u0442\u044c \u041f\u041a\u041c \u0434\u043b\u044f \u0441\u0442\u0440\u0435\u043b\u044c\u0431\u044b \u0438\u0437 \u043e\u0440\u0443\u0434\u0438\u044f(\u043d\u0443\u0436\u043d\u044b \u043f\u0443\u043b\u0438)");
p_77624_3_.add(
"\u00a79\u0414\u0430\u0451\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u0438 II \u0438 \u041f\u0440\u044b\u0433\u0443\u0447\u0435\u0441\u0442\u0438 III");
p_77624_3_.add(
"\u00a7c\u0428\u0430\u043d\u0441 \u043a\u0440\u0438\u0442\u0430 \u00a7420%\u00a7c, \u0443\u0440\u043e\u043d \u0432\u044b\u0440\u0430\u0441\u0442\u0435\u0442 \u0434\u043e 70-100");
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
super.onUpdate(stack, world, entity, par4, par5);
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
ItemStack equipped = player.getCurrentEquippedItem();
if (equipped == stack) {
player.addPotionEffect(new PotionEffect(Potion.jump.id, 2, 2, true));
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 2, 1, true));
}
}
}
}