Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Thornack

Members
  • Joined

  • Last visited

Everything posted by Thornack

  1. I have no idea why AbstractClientPlayer.getLocationSkin(playerName); is returning me a resource location with a missing texture
  2. the print lines are called but the block still breaks
  3. I want to intercept breaking of a block and rather than break the block I want to set its size to be small. I have the size part down but I need to be able to get the blocks tile entity to do this. the following didnt work. in my block class @Override public void breakBlock(World world, int x, int y, int z, Block block, int blockMetadata) { super.breakBlock(world, x, y, z, block, blockMetadata); System.out.println("called " + x +" " + y + " " + z); if (world.getTileEntity(x, y, z) instanceof TileEntityBush){ TileEntityBush bush = (TileEntityBush) world.getTileEntity(x, y, z); bush.growFraction = 0; System.out.println("called"); } }
  4. I think what you need to do is save the x,y,z, yaw,pitch... and your parameters to NBT using the TileEntity you have. Posting code would also be nice.
  5. No need for insults Draco, please keep the forum positive. I gave him an example of how to get whatever item or block he wants to drop when a block is clicked while holding an item based on a random probability. He can modify it as he sees fit to suit his needs. Its easy to change the code to drop a random number of the chosen item... I wouldnt call that useless as my class works.
  6. I was thinking of checking whether or not the resource domain is empty but i dont think that will work as I think it will always have a length() > 0 even if the texture is missing. Not sure how else to achieve this. I added my minecraft login credentials to eclipse debug config and gave myself a custom texture so that my player has a custom skin in game (which shows up on my player when I am debugging) but when I set the texture of my entity I get the missing texture icon when this is called this.currentTexture = AbstractClientPlayer.getLocationSkin(playerName); //I get the missing texture texture overlaid over my model but if I try this.currentTexture = AbstractClientPlayer.locationStevePng; Then I get the default steve texture/skin overlaid over my entity and it works perfectly For those who are curious if you want to test your mod with your minecraft player so that you are the same player every time add this to your Debug Configurations \ (x)= Arguments tab \ inside the Program Arguments box This is my code currently I was changing !AbstractClientPlayer.getLocationSkin(playerName).getResourceDomain().isEmpty() to AbstractClientPlayer.getLocationSkin(playerName).getResourceDomain().isEmpty() so that I could test whether or not having a custom player skin gets the entity to render without the pink/black missing texture but it doesnt. Even if the player has a normal skin when this.currentTexture = AbstractClientPlayer.getLocationSkin(playerName); //I get the missing texture texture overlaid over my model is called the missing texture shows up over my model. Anyone know what the issue is? My doRender code
  7. Im trying to check whether a given player texture/player skin exists (ie is not missing) using AbstractClientPlayer.getLocationSkin(playerName) so that if the texture is missing I can render a default texture. How would you do this?
  8. You dont really need that here is an example of what youre trying to make I drop them one at a time but you can drop as many as you want. Modify for your purposes. Also Thank you btn is ----> that a way----> ;-) public class BlockAcornLeaves extends CustomBlock{public BlockAcornLeaves(Material material) { super(material); this.setHardness(0.1f); this.setResistance(5.0f); this.setStepSound(soundTypeGrass);}public boolean isOpaqueCube(){ return false;}@Overridepublic boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { { ItemStack itemstack = entityPlayer.getCurrentEquippedItem(); if(!world.isRemote && itemstack != null && itemstack.getItem() == CommonProxy.acornHarvester )//world.isRemote == false - has to be false otherwise you do it twice once for server and once for client { this.dropRandomAcorns(world, x, y, z); } return false; }}//when the block is right clicked, drop several randomly coloured acorns and rarely an acorn leaf blockprivate void dropRandomAcorns(World world, int x, int y, int z){ int maxRand = 100000; Random random = new Random(); //probability that the item will be dropped, out of 10000 //the drop rate of each item is independent and does not affect the others. int dropProbabilities[] = { 35000, //red acorn 20000, //white acorn 2500, //blue acorn 2000, //black acorn 1500, //yellow acorn 500, //green acorn 100, //pink acorn 10, //acorn leaf block }; for(int i = 0; i < dropProbabilities.length; i++){ Item droppedItem = null; int r = MathHelper.getRandomIntegerInRange(random, 0, maxRand); if(r < dropProbabilities[i]){ switch(i){ case 0: droppedItem = CommonProxy.acornRed; break; case 1: droppedItem = CommonProxy.acornWhite; break; case 2: droppedItem = CommonProxy.acornBlue; break; case 3: droppedItem = CommonProxy.acornBlack; break; case 4: droppedItem = CommonProxy.acornYellow; break; case 5: droppedItem = CommonProxy.acornGreen; break; case 6: droppedItem = CommonProxy.acornPink; break; case 7: droppedItem = Item.getItemFromBlock(CommonProxy.blockAcornLeaves); break; } if(droppedItem != null){ ItemStack myItemStack = new ItemStack(droppedItem, 1); EntityItem entityitem = new EntityItem(world, x, y, z, myItemStack); entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); } } }}
  9. 1) use System.out.println(); in various places to aid in debugging (if you type Sysout or sysout and click the ctrl and the space keys on keyboard) this is a short way of typing System.out.println(); 3) Watch some java tutorials before posting because people always get upset if you dont have a decent understanding of JAVA - I know this from experience 4) some useful modding links: Useful Resources 5) Look at Vanilla classes figure out how they work - great way to accomplish stuff you want. If modding in Eclipse look in ReferenceLibraries\forgeSrc to find the source code for Minecraft 6) in Eclipse pressing the Ctrl and the H keys together when in the Package Explorer is useful in finding stuff in your code/vanilla code 7) If you want to figure out how a function is called right click on it and press Ctrl + Alt + H keys together to see where it is called in code The Thank You button is located ---------------------------------> That way ish ---------------------->
  10. Thanks to Ernio I have managed to get this solved, Basically I use a data watcher to get the owner's name of the entity and inside my doRender method I get the model from the owners string. This is all triggered by calling the setMorphedIntoPlayer method that is located inside my entity class when the player morphs. However I have a problem with the texture, the pink/black missing texture texture is overlaid onto the modelBiped rather than the players texture. Anyone know why? I suspect it is because when in my development environment I am in offline mode and the player doesn't have a skin but I am not sure how to test this. @SideOnly(Side.CLIENT) public class RenderCustomType extends RenderLiving // if I extend RendererLivingEntity the Exp bar always renders and we don't want this { private ModelBase playerModel = new ModelBiped(); private ModelBase consistentModel; private ResourceLocation consistentTexture; private ResourceLocation currentTexture; public RenderCustomType(ModelBase model, String textureName, float shadowRadius) { super(model, shadowRadius); this.consistentTexture = new ResourceLocation("custommod:textures/mob/" + textureName); this.consistentModel = model; } public void drawExpBar(EntityLiving entityLiving, double d, double d1, double d2, float unused, float f1) { float f2 = 1.6F; float f3 = 0.01666667F * f2; if ((float) entityLiving .getDistanceToEntity(renderManager.livingPlayer) < 28F && Minecraft.isGuiEnabled()) { GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + 1.1F, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); Tessellator tessellator = Tessellator.instance; byte byte0 = -20; GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); float f5 = 5; float f6 = 1; if (f5 >= f6) f5 = 56; float f8 = 50F * (f5 / f6); tessellator.setColorRGBA_F(0.0039F, 0.03137F, 0.4196F, 1.0F); tessellator.addVertex(-25F + f8, -7 + byte0, 0.0D); tessellator.addVertex(-25F + f8, -6 + byte0, 0.0D); tessellator.addVertex(25D, -6 + byte0, 0.0D); tessellator.addVertex(25D, -7 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.8901F, 0.8901F, 1.0F); tessellator.addVertex(-25D, -7 + byte0, 0.0D); tessellator.addVertex(-25D, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 25F, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 25F, -7 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } } @Override public void doRender(Entity entity, double x, double y, double z, float f, float F) { if (entity instanceof EntityCustomType) { EntityCustomType ent = (EntityCustomType) entity; String playerName = ent.getIsMorphedToPlayer(); if (playerName != null && !playerName.equals("")) { this.currentTexture = AbstractClientPlayer.getLocationSkin(playerName); this.mainModel = this.playerModel; } else { this.currentTexture = this.consistentTexture; this.mainModel = this.consistentModel; } } super.doRender(entity, x, y, z, f, F); } in my Entity class public String getIsMorphedToPlayer() { return this.dataWatcher.getWatchableObjectString(MORPHED_PLAYER_NAME); } public void setMorphedIntoPlayer(boolean shouldBeMorphed) { if (shouldBeMorphed){ this.dataWatcher.updateObject(MORPHED_PLAYER_NAME, this.getPlayerName()); } else { this.dataWatcher.updateObject(MORPHED_PLAYER_NAME, ""); } }
  11. Haha I guess I had a brain fart ive been coding for a good number of hours guess I need a break but ya that totally makes sense I should have come to that myself thanks everybody
  12. Im not really sure what you mean since the constructor is called only once which sets the model with its registered renderer, I have no idea how to then change the existing model once it has already been set. I can put the fields in like this but changing them wont do anything since they aren't used in the actual rendering. public ResourceLocation texture; public ModelBase model; public RenderCustomType(ModelBase model, String textureName, float shadowRadius) { super(model, shadowRadius); this.model = model; this.texture = new ResourceLocation("custommod:textures/mob/" + textureName); }
  13. Would there be a way to change the model from inside my custom Entities class. For example if my custom mob had some superclass like EntitySuperclass could I do something inside this Entity class of the sort (psuedo code) -> if(this.isInParty && this.hasOwnerChangedModel== true) {Change the model to be a ModelCreeper lets say} where all of the entities that extend this class will have the ability to change their model to be a creeper if the player changes their model. My entities all extend a super class and I want all of my custom mobs that extend this class to have the ability to change their model when the player calls my changeModel method so that when the player becomes the mob that is part of his party then the mob can become the player to simulate player the player swap functionality i mentioned earlier.
  14. Jabelar I see what you mean, although my mod has quite a few models it would be pretty tedious to have to include the model of the player in each one, I think I need a better way. Abastro - thanks for the tip ill look at the bat class
  15. I already have a custom renderer, My issue is that the constructor is called once and thus sets the model and the texture. I need to be able to somehow change these to be whatever I want after it has already been set. I dont know how to do that. How do you change a private field, I tried using reflection in the past but I dont really get how to use it properly. @SideOnly(Side.CLIENT) public class RenderCustomType extends RenderLiving // if I extend RendererLivingEntity the Exp bar always renders and we don't want this { private ResourceLocation texture; public RenderCustomType(ModelBase model, String textureName, float shadowRadius) { super(model, shadowRadius); this.texture = new ResourceLocation("custommod:textures/mob/" + textureName); } public void drawExpBar(EntityLiving entityLiving, double d, double d1, double d2, float unused, float f1) { float f2 = 1.6F; float f3 = 0.01666667F * f2; if ((float) entityLiving .getDistanceToEntity(renderManager.livingPlayer) < 28F && Minecraft.isGuiEnabled()) { GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + 1.1F, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); Tessellator tessellator = Tessellator.instance; byte byte0 = -20; GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); float f5 = 5; float f6 = 1; if (f5 >= f6) f5 = 56; float f8 = 50F * (f5 / f6); tessellator.setColorRGBA_F(0.0039F, 0.03137F, 0.4196F, 1.0F); tessellator.addVertex(-25F + f8, -7 + byte0, 0.0D); tessellator.addVertex(-25F + f8, -6 + byte0, 0.0D); tessellator.addVertex(25D, -6 + byte0, 0.0D); tessellator.addVertex(25D, -7 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.8901F, 0.8901F, 1.0F); tessellator.addVertex(-25D, -7 + byte0, 0.0D); tessellator.addVertex(-25D, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 25F, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 25F, -7 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity entity, double x, double y, double z, float par8, float par9){ super.doRender(entity, x, y, z, par8, par9); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity entity){ return this.texture; } }
  16. Anyone know how to achieve this? How would you change an entities model after it already has one in game?
  17. Hi Everyone, I have figured out how to change the Player model and how to update it dynamically so that when a player changes his/her model other players see the change occur also. I now want to change my custom entities model (this entity is not the player) to simulate a player - entity swap. Basically I want to swap the player with the entity, so the player becomes the entity and the entity becomes the player (where each stores the others stats, has the others model, and everything that the other had before the swap occurred. I want this to occur on the command of the player and I want it reversible). I have a pretty good idea how to do the command part (have that mostly figured out since I can change the players model to the model of the Entity I want) but I have no idea how to change the model of my custom entity. Anyone have any ideas how to accomplish this? The Entity I want to change the model for (so that its model is changed to a model of Steve) is a custom entity that the player "finds" using the following method inside my WorldHelper class. its model is registered in my ClientProxy class in the following way and here is my RenderCustomType class Note* EntityCustomRegistry is a class that contains a hash map that maps my entities names to ids and has a custom collection of such methods
  18. I got this Idea from digging around to use the PlayerEvent.StartTracking event to establish the link between the entity and the player as long as both are tracking each other. Im not sure if this is the best approach but I think it should work, if I do the appropriate checks and get the exact entity I want then somehow send packets to update each about the others position and what not. @SubscribeEvent(priority=EventPriority.NORMAL) public void onTracking(PlayerEvent.StartTracking event) { //Establish the link here } }
  19. This is my working party class where I store my entity data for the party members that the player has acquired. I want to somehow establish a dynamic link between the entities that the player spawns into the world and the player himself so that the player knows the position of each entity and their stats etc etc... I was wondering how would be a good way to go about doing this. Any ideas? FYI atm I use a pretty bad method to check whether or not each entity is spawned in the world using arrays (and im trying to come up with a better method for determining if a party member is spawned in the world or not but for now the one I have seems to work). I use an int array that sets the value of the array slot to my party NBT[] slot # when the mob is spawned and resets it to -1 when the mob is not spawned, I then get the mobs NBT from the value of the slots spawnedSelectedSlot[]), but if I create a dynamic link between the entities and the NBT data that is saved here then I wont have to use the inefficient system i dont think). public class PlayerParty implements IExtendedEntityProperties { protected EntityPlayer entityPlayer; protected EntityPlayer ownerName; public static final int NUM_SLOTS = 6; public int currentSelectedSlot = 0; //default slot is the first slot public int[] spawnedSelectedSlot = new int[6]; public boolean partyFull = false; // Used in EventTryToAddMobToParty in the tryToAddMobToParty it allows for one to get a spawnegg item if party is full that contains the mob private static final String EXTENDED_ENTITY_PROPERTIES_TAGNAME = "PlayerParty"; protected NBTTagCompound[] customMobPartyNbt = new NBTTagCompound[NUM_SLOTS]; public PlayerParty(EntityPlayer player) { this.entityPlayer = player; spawnedSelectedSlot[0] = -1; //A value of -1 should mean that the mob in slot 0 is not spawned spawnedSelectedSlot[1] = -1; spawnedSelectedSlot[2] = -1; spawnedSelectedSlot[3] = -1; spawnedSelectedSlot[4] = -1; spawnedSelectedSlot[5] = -1; } //sets the customMob in the specified slot. Stores only the NBT data, which is enough to recreate the customMob later. // doesnt seem to be explicitly called but without it customMob dont go into the party public void setCustomMob(int slot, EntityCustomMob customMob, NBTTagCompound caughtTag){ NBTTagCompound compound = new NBTTagCompound(); customMob.writeToNBT(compound); customMobPartyNbt[slot] = compound; } public void setCustomMobInSlot(int slot, NBTTagCompound customMob, int mobID, String ownerName){ customMobPartyNbt[slot] = customMob; //the NBTTagCompound that is being passed here from tryToAddMobToParty() method inside EventTryToAddMobToParty class doesnt have a key ie (customMob.hasKey("caughtCustomMob") = false) here dunno y but we need it to be true customMobPartyNbt[slot].setInteger("MobID", mobID); System.out.println("ownerName "+ ownerName); customMobPartyNbt[slot].setString("ownerName", ownerName); } public void setSelectedSlot(int slot){ currentSelectedSlot = slot; } public int getSelectedSlot(){ return currentSelectedSlot; } public int getSpawnedSlot(){ for(int i = 0; i < NUM_SLOTS; i++){ if(this.spawnedSelectedSlot[i] !=-1) return i; } return -1; } //returns true if the player has a free party slot public boolean hasFreeSlot(){ return (this.getNextFreeSlot() >= 0); } //gets the first free slot in the player's party. The NBT tag compound that slot position should //be null. public int getNextFreeSlot(){ for(int i = 0; i < NUM_SLOTS; i++){ if(this.customMobPartyNbt[i] == null) return i; } return -1; } public int getNextFullSlot(){ for(int i = 0; i < NUM_SLOTS; i++){ if(this.customMobPartyNbt[i] != null) return i; } return -1; } public NBTTagCompound getCustomMobNBTFromSlot(int slot){ return customMobPartyNbt[slot]; } public void swapCustomMobn(int slotOne, int slotTwo, boolean wasPressed){ if(slotOne != -1 && slotTwo!=-1){ NBTTagCompound tempSlot = customMobPartyNbt[slotOne]; customMobPartyNbt[slotOne] = customMobPartyNbt[slotTwo]; customMobPartyNbt[slotTwo] = tempSlot; } } /** * Used to register these extended properties for the player during EntityConstructing event */ public static final void register(EntityPlayer player) { player.registerExtendedProperties(EXTENDED_ENTITY_PROPERTIES_TAGNAME, new PlayerParty(player)); } /** * Copies additional player data from the given BattleMobExtendedPlayerHelper instance * Avoids NBT disk I/O overhead when cloning a player after respawn */ public void copy(PlayerParty properties) { customMobPartyNbt = properties.customMobPartyNbt.clone(); } /** * Returns BattleMobExtendedPlayerHelper properties for player */ public static final PlayerParty get(EntityPlayer player) { return (PlayerParty) player.getExtendedProperties(EXTENDED_ENTITY_PROPERTIES_TAGNAME); } @Override public void saveNBTData(NBTTagCompound compound) { NBTTagCompound properties = new NBTTagCompound(); for(int i=0; i < NUM_SLOTS; i++){ if(customMobPartyNbt[i] != null){ properties.setTag("Slot"+ i, customMobPartyNbt[i]); } } compound.setTag(EXTENDED_ENTITY_PROPERTIES_TAGNAME, properties); } @Override public void loadNBTData(NBTTagCompound compound) { NBTTagCompound properties = (NBTTagCompound) compound.getTag(EXTENDED_ENTITY_PROPERTIES_TAGNAME); if(properties != null){ for(int i=0; i < NUM_SLOTS; i++){ if(properties.hasKey("Slot"+i)){ customMobPartyNbt[i] = properties.getCompoundTag("Slot"+i); } } } } public void updatePlayerPartyServerToClient(){ PacketOverlord.sendTo(new PacketSyncPlayerParty((EntityPlayer) entityPlayer),(EntityPlayerMP) entityPlayer); } @Override public void init(Entity entity, World world) { } }
  20. Also youtube Neale Gaming he does a nice job of this I think. -> https://www.youtube.com/channel/UCCZTT2mbRpOPjIxd5qM9b8A This is his channel his series for 1.7.10 is pretty good. [EDIT] Also Mr CrayFish has ok tutorials for 1.7.10 and just started a series for 1.8 This is the first episode for 1.7.10 ->
  21. Hi everyone, So I want to set up a dynamic link between a series of entities and the player so that the player has each spawned entities position data (that updates dynamically as the entity moves) and all of the entities properties also. I have a player that has the NBT data for a party of entities. This player can use the data that is stores in his IEEP to spawn these entities at will and can despawn them/update the NBT that is saved to the IEEP also. I now want to establish a link dynamic link between the player and the entity that is spawned in the world so that the player has stuff like the position and all properties of the entity at all times during which the entity is spawned in the world. How would you go about doing this? any ideas? Also as a side question, should I update to 1.8 or is it a pain, I understand that rendering changed like crazy and from what ive been reading a lot is a pain to fix but is it worth it? As always any input is greatly appreciated
  22. I have a question about the players UUID. How are they actually saved, Ive been looking at the Yggdrasil class with Ernio and we both got stumped by how/where the players uuid is actually being saved. I want to create a dynamic link between an entity and the player and so far I havent had any luck with this.
  23. Ya I see what youre saying its a bit of work to make this right though atm so im thinking about how to get this done. Not a quick fix
  24. Thornack replied to Asweez's topic in Modder Support
    also [joke alert] the Thank You Btn is located over here somewhere -------------------------------------------------------------------------------------------------------------------------------------->
  25. Thornack replied to Asweez's topic in Modder Support
    Fairly easy start with public class EntityVehicle extends EntityAnimal { public EntityVehicle (World par1World) { super(par1World); this.setSize(1F, 1F); } public EntityVehicle (World par1World, double par2, double par4, double par6) { this(par1World); this.setPosition(par2, par4 + (double) this.yOffset, par6); } } //then look at horse code for the rest in particular pay attention to // this is my customized version for my Bicycle vehicle @Override public void moveEntityWithHeading(float moveStrafing, float moveForward) { if (this.riddenByEntity != null) { this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw; this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F; this.setRotation(this.rotationYaw, this.rotationPitch); this.rotationYawHead = this.renderYawOffset = this.rotationYaw; moveStrafing = 0; //moveStrafing = strafing. Should be 0, since we don't want the bike to move side to side. moveForward = ((EntityLivingBase) this.riddenByEntity).moveForward* bicycleMovementSpeedMultiplier; if (moveForward <= 0.0F) { moveForward *= 0.25F; //you move 1/4 of the speed when going backwards } if(this.onGround){ this.jumpPower = 0.0f;//(float)this.getBicycleJumpPower(); } if (this.jumpPower > 0.0F && !this.isBicycleJumping() && this.onGround) { this.motionY = this.jumpPower; //getBicycleJumpPower() this.onGround = false; this.isAirBorne = true; this.jumpPower = 0.0F; } this.stepHeight = 1.0F; this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F; if (!this.worldObj.isRemote) { this.setAIMoveSpeed((float) this.getEntityAttribute( SharedMonsterAttributes.movementSpeed) .getAttributeValue()); //System.out.println("moveStrafing: "+moveStrafing+" moveForward: "+moveForward); super.moveEntityWithHeading(moveStrafing, moveForward); } if (this.onGround) { this.jumpPower = 0.0F; this.setBicycleJumping(false); //System.out.println("jumpPower: "+jumpPower+" if (this.onGround)"); } } else { this.stepHeight = 0.5F; this.jumpMovementFactor = 0.02F; super.moveEntityWithHeading(moveStrafing, moveForward); } } and pay attention to /** * Returns true if this entity should push and be pushed by other entities * when colliding. */ public boolean canBePushed() { return this.riddenByEntity == null; } /** * Called when the mob is falling. Calculates and applies fall damage. */ protected void fall(float par1) { if (par1 > 1.0F) { //this.playSound("mob.Horse.land", 0.4F, 1.0F); } int i = MathHelper.ceiling_float_int(par1 * 0.5F - 3.0F); if (i > 0) { this.attackEntityFrom(DamageSource.fall, (float)i); if (this.riddenByEntity != null){ this.riddenByEntity.attackEntityFrom(DamageSource.fall, (float)i); } Block block = this.worldObj.getBlock( MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - 0.2D - (double) this.prevRotationYaw), MathHelper.floor_double(this.posZ)); if (block.getMaterial() != Material.air) { Block.SoundType soundtype = block.stepSound; this.worldObj.playSoundAtEntity(this, soundtype.getStepResourcePath(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F); } } } /** * Called when a player interacts with a mob. Here we mount the player on the vehicle when right clicked. */ public boolean interact(EntityPlayer par1EntityPlayer) { } public void onLivingUpdate() { super.onLivingUpdate(); } public void onUpdate() { super.onUpdate(); } @Override public EntityAgeable createChild(EntityAgeable par1EntityAgeable) { return null; } @Override public double getMountedYOffset(){ return 1.0; } /* * Returns true if the new AI system should be used. Should not remove, otherwise the vehicle will use the * AI of a passive mob */ @Override protected boolean isAIEnabled(){ return true; } @Override public boolean isOnLadder() { return false; }

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.