Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** mod_KorriSPlayground.java **/
- package net.minecraft.src;
- import java.util.Map;
- import net.minecraft.src.korri.*;
- public class mod_KorriSPlayground extends BaseMod {
- public static final Item itemFly;
- static {
- itemFly = new ItemFly(2001).setItemName("fly");
- }
- @Override
- public String getVersion() {
- return "0.01";
- }
- @Override
- public void load() {
- ModLoader.RegisterEntityID(EntityFly.class, "Fly",
- ModLoader.getUniqueEntityId());
- itemFly.iconIndex = ModLoader.addOverride("/gui/items.png",
- "/korri/rocket.png");
- ModLoader.AddName(itemFly, "Fly baby fly !");
- ModLoader.AddRecipe(new ItemStack(itemFly, 1),
- new Object[] { " X ", "X X", "YYY", Character.valueOf('X'),
- Item.stick, Character.valueOf('Y'), Block.planks });
- }
- @Override
- public void AddRenderer(Map map) {
- map.put(EntityFly.class, new RenderFly());
- }
- }
- /** ItemFly.java **/
- package net.minecraft.src.korri;
- import net.minecraft.src.BlockRail;
- import net.minecraft.src.EntityMinecart;
- import net.minecraft.src.EntityPlayer;
- import net.minecraft.src.Item;
- import net.minecraft.src.ItemStack;
- import net.minecraft.src.World;
- public class ItemFly extends Item {
- public ItemFly(int i) {
- super(i);
- maxStackSize = 1;
- }
- public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer,
- World world, int i, int j, int k, int l) {
- if (!world.isRemote) {
- world.spawnEntityInWorld(new EntityFly(world, (float) i + 0.5F,
- (float) j + 0.5F, (float) k + 0.5F));
- System.out.println("New Fly !");
- }
- itemstack.stackSize--;
- return true;
- }
- }
- /** EntityFly.java **/
- package net.minecraft.src.korri;
- import java.util.List;
- import net.minecraft.src.*;
- public class EntityFly extends Entity {
- public EntityFly(World world) {
- super(world);
- preventEntitySpawning = true;
- setSize(1.0F, 0.3F);
- yOffset = height / 2.0F;
- }
- public EntityFly(World world, float x, float y, float z) {
- this(world);
- setPosition(x, y + (double) yOffset, z);
- }
- protected boolean canTriggerWalking() {
- return false;
- }
- public boolean canBeCollidedWith() {
- return true;
- }
- public boolean canBePushed() {
- return true;
- }
- public double getMountedYOffset() {
- return -0.3D;// (double)height * 0.0D - 0.30000001192092896D;
- }
- public boolean interact(EntityPlayer entityplayer) {
- if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer)
- && riddenByEntity != entityplayer) {
- return true;
- }
- if (!worldObj.isRemote) {
- entityplayer.mountEntity(this);
- }
- return true;
- }
- public void onUpdate() {
- super.onUpdate();
- if (riddenByEntity != null && riddenByEntity.isDead) {
- riddenByEntity = null;
- }
- }
- @Override
- protected void entityInit() {
- }
- @Override
- protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
- // super.readFromNBT(nbttagcompound);
- }
- @Override
- protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
- // super.writeToNBT(nbttagcompound);
- }
- }
- /** RenderFly.java **/
- package net.minecraft.src.korri;
- import net.minecraft.src.Entity;
- import net.minecraft.src.EntityBoat;
- import net.minecraft.src.MathHelper;
- import net.minecraft.src.ModelBase;
- import net.minecraft.src.ModelBoat;
- import net.minecraft.src.Render;
- import org.lwjgl.opengl.GL11;
- public class RenderFly extends Render {
- protected ModelFly modelFly;
- public RenderFly() {
- shadowSize = 0.5F;
- modelFly = new ModelFly();
- }
- public void renderFly(EntityFly entityfly, double d, double d1, double d2,
- float f, float f1) {
- loadTexture("/korri/fly.png");
- modelFly.render(entityfly, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- }
- public void doRender(Entity entity, double d, double d1, double d2,
- float f, float f1) {
- renderFly((EntityFly) entity, d, d1, d2, f, f1);
- }
- }
- /** ModelFly.java **/
- package net.minecraft.src.korri;
- import net.minecraft.src.*;
- public class ModelFly extends ModelBase {
- // fields
- ModelRenderer Sit;
- public ModelFly() {
- textureWidth = 52;
- textureHeight = 15;
- Sit = new ModelRenderer(this, 0, 0);
- Sit.addBox(0F, 0F, 0F, 16, 5, 10);
- Sit.setRotationPoint(8F, 0F, 5F);
- Sit.setTextureSize(textureWidth, textureHeight);
- Sit.mirror = true;
- setRotation(Sit, 0F, 0F, 0F);
- }
- public void render(Entity entity, float f, float f1, float f2, float f3,
- float f4, float f5) {
- // super.render(entity, f, f1, f2, f3, f4, f5);
- GL11.glPushMatrix();
- setRotationAngles(f, f1, f2, f3, f4, f5);
- Sit.render(f5);
- GL11.glPopMatrix();
- }
- private void setRotation(ModelRenderer model, float x, float y, float z) {
- model.rotateAngleX = x;
- model.rotateAngleY = y;
- model.rotateAngleZ = z;
- }
- public void setRotationAngles(float f, float f1, float f2, float f3,
- float f4, float f5) {
- super.setRotationAngles(f, f1, f2, f3, f4, f5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement