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.

Mew

Members
  • Joined

  • Last visited

Everything posted by Mew

  1. Reading through that crash report, it seems as though you are using the method "preloadTexture(String texture)"? If you are, I would suggest getting rid of it. I may actually (considering this is the second time now) update that tutorial... Hmmm... Ill get back to you on that one. But yeah, preloadTexture(String texture) is no longer "valid". Minecraft/forge no longer uses that to load the texture into memory. It does that via the icon registry in the block/item class.
  2. Your welcome. Just in case you haven't quite gotten this yet... If your not having fun, try something different. There are many, MANY different things to do when it comes to modding. Items with abilities and such are just a scratch on the surface. So once again, HAVE FUN!!!
  3. Yeah, we did that tonight with the kids, just seeing that they could make a texture and import it in MC, they thought it was the coolest thing! Speaking of: can anyone recommend a good website / book on (basic ) java? Up to date? Other good modding tutorials than Forge's? Thanks. I'd recommend using oracle's (I think thats it) tutorials. They are the creators of Java and have VERY good documentation on it. I think the basics are here: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/ For forge tutorials... umm, I am not sure of any good ones for the time being. Since 1.6.1 has now been sprung upon us, tutorials could take a bit to come out. I have always wanted to write a few tutorials, but I am still nutting out 1.6.1!
  4. Well, good luck! I hope you're having fun! Fun doesn't begin to describe it! And I hope you and your kids can have fun building your dreams into minecraft. And as an extra, if you ever need some help with some specifics, send me a PM! I may or may not be able to help you depending on what it is. As with all sorts of jobs, there are (I guess) specializations in modding aswell. I tend to be a whatever I want to learn about guy, but thats beside the point. The offer stands, if you want it, ask for it! - Mew
  5. @HydroFlame Really? That's interesting... It'd be cool to have a look through your code, that or hear what ideas you have planned! I also agree with you on the openGL, I am sorta scratching the surface at the moment with some model rendering. It's a pain @OP Like I said before, modding is really just for the fun of it! It doesn't really work as a job because people don't want to pay for a mod, donations don't come often (speculation on my part though), and people generally don't appreciate what it takes to make a mod. Basic blocks and items... I remember my first item The best part about simple items/blocks is making the texture for it, thats really the best bit. Once you get into making the blocks and items do stuff... Wow!! It's so much fun!
  6. Bind Texture has been replaced with *pulls up code*: Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("/assets/MODID/textures/model/TEXTURENAME.png")); Hope this helps!
  7. A lot of people at my school have said that I was made from a computer (I take no offence to that, I find it funny actually) because I always used to talk about HOW I wanted to learn a programming language. I used to watch tutorials on minecraft mods just for the fun of it, I never actually made them (this is going back 4 years). I have only really started programming in the last year. I admittedly haven't made anything useful, but I have learnt a lot from doing so. I have made a text editor, a escape the room text based game, and at the moment I am working on an RPG mod called MinePG. I am still learning, just like everyone does, and I can't wait until I am ready to have MinePG ready for full on RPG type stuff. At the moment... well, its a really basic mod I guess. A lot of the code I am actually re-writing because, as I learn from people who know what their doing show me new and better ways of doing things, I see that my code could be done in a much more compact way. Also, in case I seem like I am bragging about picking up coding in a year, I still consider myself an amateur. I rely on other help ALOT.
  8. Glad I could help I know I got REALLY confused when it came to the basics of modding when I started. Python eh? My friend dabbles in the art of Python. I know the tiniest little bit myself... I can write a for loop and a print statement with an if and that's probably about it
  9. Just note that even though this may be the case, I would be willing to help anyone no matter what their past experience is. And it isn't a matter of whether or not he knows the basics, it was more a matter of being disrespectful. Respect is a big part of the community, if you don't have it the world doesn't yield enjoyable results for you. If what you were trying to point out is that he should go learn some basics of Java, then you should have pointed it out in a nice way, not just going, "You don't know the basics? I don't care!", which is what you seem to be doing at the moment. I also agree that is a good idea to learn the basics of Java before modding, I didn't and I reaped the consequences dearly... It is his choice whether or not he wants to learn the basics first, he may not know that it would help him, and I realize that I should have pointed that out aswell. But I like helping people with code, it seems to be a hobby of mine. (and I am off on a tangent, sorry people!) I hope you get my point. @OP As you may read in may (small) tangent, we would recommend learning the basics of Java (your kids too) so that you have a better idea of how things work when you get to the harder stuff. A lot of things you can do in mods depends on the basics. Sorry about the tangent and I hope you and your kids have a fun time modding! - Mew
  10. @OP You have missed adding in the directory to the sound, right now the sound is trying to load from the Minecraft directory (at least I think thats where it defaults... ). Here is my SounRegistering equivalent: package rpg.sounds; import java.net.URL; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; import rpg.lib.Reference; public class SoundLoader { public static boolean didSoundsLoad; private static final String[] SOUNDS = { "karmaup", "karmadown", "karmaerror" }; private URL getSound(String sound) { return this.getClass().getResource("/assets/" + Reference.MOD_ID + "/resource/sound/" + sound + ".ogg"); // note that mine has assets as the base... That is because I am using 1.6.1. Should be mods if 1.5.2 } @ForgeSubscribe public void onSoundLoad(SoundLoadEvent evt) { for (String sound : SOUNDS) { evt.manager.soundPoolSounds.addSound("minepg/" + sound + ".ogg"); System.out.println("[MinePG Sound Loader] Loading sounds..."); SoundLoader.didSoundsLoad = true; System.out.println("[MinePG Sound Loader] Sounds Loaded"); } } }
  11. Learn to be respectful man .. these are real people you are talking to. Just because you find stuff like that simple doesn't mean everyone in the world does. Everyone has different strengths and weaknesses. Learn it, and learn it quickly. @OP (Original Post) Some of those methods are out of date First thing first, since you don't seem to know much about coding in java (as hydroflame has so... unceremoniously pointed out), ill explain things a bit more detailed than normal. The constructor of your GenericOre class is asking for two parameters, an integer and a material. But, if you look in the BlockOre class, its constructor only asks for one parameter, and integer. BlockOre already sets the material to Material.rock when it passes its parameters to its super class. I won't be too quick to give you answers, as everyone should just be pointed in the right direction, even though I am about to tell you exact answers in a second, that is because some of the stuff you are using is now non-existent. Second is that setBlockName(String name) no longer exists. It has been replaced with setUnlocalizedName(String name). Don't ask me why, but that's the way it is. All in all, it seems to me that the tutorial you are using is a little (just a little) bit outdated. Hope all the help a 14 year old can give actually helps! - Mew
  12. @Lex: I know that we are supposed to put stuff in the init, (I don't know why) but I have always had my stuff in the pre-init. I am really not sure why. @SoniEX2: Sorry about that. I am not sure. You will have to read documentation and get input straight from the source, excuse the pun, LexManos
  13. I really don't know But what I DO know is that I have always used pre-init... Anyway. I think its to do with the textures flunking out in 1.6.1. I also noticed that in 1.6.1 forge, no items get rendered in the players hand in third person view. But that's beside the point! Sorry for not being that helpful... I didn't get anyone else's' problems, my textures worked fine!
  14. I have a PlayerInformation file (https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/playerinfo/PlayerInformation.java) that contains information like the players class (EXTREMELY important to keep), a boolean that shows a special screen on start of a new world (Also EXTREMELY important to keep) plus other stuff. The problem is, is that those variables get "reset" when the player dies. So that means that the player's class and wether or not he has chosen a class gets reset. Which means that if the player would then log out, and relog, he would find that he could change his class. Also his karma/level would be reset aswell. I won't get into the full details, but basically there is a bunch of this stuff that I need to keep across player death. I am not too sure of how to go about this (I am thinking something along the lines of a temp file that gets created and rewritten when the player dies. Then reading all that temp data back into the variables when the player respawns and then deleting the temp file... but I don't think that is the easiest way), so any help will be appreciated! And if anyone could point me in the direction for keeping the vanilla experience and levels after the player dies as well, I would be very thankful for it. - Mew
  15. I have a working custom arrow/bow now (except that the bow doesn't look the same as the vanilla bow when rendered in the players hand and it doesn't "zoom in" the screen the longer you hold the right mouse key). But that isnt the issue. What the issue is, is that when the arrow is fired it shoots and "lands" on the ground, the arrow is rendered above the ground in a seemingly random place. but if you walk to where the trajectory of the arrow should have ended it in the ground, you pick up the arrow from that location. Any ideas on what is causing this? I believe it is a syncing issue between the client and server. Because if you either wait a seemingly random time or shoot a vanilla arrow and wait until the arrow renders, the issue seems to fix itself. My code is exactly the same as thegrovesyproject101 at this site: http://thegrovesyproject101.weebly.com/uploads/1/4/6/0/14605888/custom_arrow.txt
  16. Why do you need it saved to a file?? Oh right, you need some way of doing NBT saves. Try doing something like so: [urlhttps://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/playerinfo/PlayerInformation.java[/url]
  17. I shall do so. Its been awhile since I have played with this file and, wanting a quick answer, I posted the problem here. That makes sense... *facepalms*
  18. As the title not-so-clearly states, I have a custom bow that shoots a custom arrow, but when the player is in survival, the arrow seemingly hits the player causing damage. I am not sure if the arrow is just causing damage to the player and not actually spawning, or if the arrow is being spawned, BEHIND the player, but I could use some help with it. EntityArrowTraining" package rpg.client.entities.projectiles; import java.util.List; import net.minecraft.block.Block; import net.minecraft.enchantment.EnchantmentThorns; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.IProjectile; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.packet.Packet70GameEvent; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import rpg.config.base.archer.ArcherWeapons; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class EntityArrowTraining extends EntityArrow implements IProjectile { private int xTile = -1; private int yTile = -1; private int zTile = -1; private int inTile = 0; private int inData = 0; private boolean inGround = false; /** 1 if the player can pick up the arrow */ public int canBePickedUp = 0; /** Seems to be some sort of timer for animating an arrow. */ public int arrowShake = 0; /** The owner of this arrow. */ public Entity shootingEntity; private int ticksInGround; private int ticksInAir = 0; private double damage = 2.0D; /** The amount of knockback an arrow applies when it hits a mob. */ private int knockbackStrength; public EntityArrowTraining(World par1World) { super(par1World); this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); } public EntityArrowTraining(World par1World, double par2, double par4, double par6) { super(par1World); this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); this.setPosition(par2, par4, par6); this.yOffset = 0.0F; } public EntityArrowTraining(World par1World, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving, float par4, float par5) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLiving; if (par2EntityLiving instanceof EntityPlayer) { this.canBePickedUp = 1; } this.posY = par2EntityLiving.posY + par2EntityLiving.getEyeHeight() - 0.10000000149011612D; double d0 = par3EntityLiving.posX - par2EntityLiving.posX; double d1 = par3EntityLiving.boundingBox.minY + par3EntityLiving.height / 3.0F - this.posY; double d2 = par3EntityLiving.posZ - par2EntityLiving.posZ; double d3 = MathHelper.sqrt_double(d0 * d0 + d2 * d2); if (d3 >= 1.0E-7D) { float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI)); double d4 = d0 / d3; double d5 = d2 / d3; this.setLocationAndAngles(par2EntityLiving.posX + d4, this.posY, par2EntityLiving.posZ + d5, f2, f3); this.yOffset = 0.0F; float f4 = (float) d3 * 0.2F; this.setThrowableHeading(d0, d1 + f4, d2, par4, par5); } } public EntityArrowTraining(World par1World, EntityLiving par2EntityLiving, float par3) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLiving; if (par2EntityLiving instanceof EntityPlayer) { this.canBePickedUp = 1; } this.setSize(0.5F, 0.5F); this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch); this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.posY -= 0.10000000149011612D; this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(this.posX, this.posY, this.posZ); this.yOffset = 0.0F; this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F); } @Override protected void entityInit() { this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); } /** * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. */ @Override public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) { float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); par1 /= f2; par3 /= f2; par5 /= f2; par1 += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * par8; par3 += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * par8; par5 += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * par8; par1 *= par7; par3 *= par7; par5 *= par7; this.motionX = par1; this.motionY = par3; this.motionZ = par5; float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, f3) * 180.0D / Math.PI); this.ticksInGround = 0; } @Override @SideOnly(Side.CLIENT) /** * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, * posY, posZ, yaw, pitch */ public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { this.setPosition(par1, par3, par5); this.setRotation(par7, par8); } @Override @SideOnly(Side.CLIENT) /** * Sets the velocity to the args. Args: x, y, z */ public void setVelocity(double par1, double par3, double par5) { this.motionX = par1; this.motionY = par3; this.motionZ = par5; if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5); this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, f) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch; this.prevRotationYaw = this.rotationYaw; this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); this.ticksInGround = 0; } } /** * Called to update the entity's position/logic. */ @Override @SuppressWarnings("rawtypes") public void onUpdate() { super.onUpdate(); if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI); } int i = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); if (i > 0) { Block.blocksList[i].setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile); AxisAlignedBB axisalignedbb = Block.blocksList[i].getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile); if (axisalignedbb != null && axisalignedbb.isVecInside(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ))) { this.inGround = true; } } if (this.arrowShake > 0) { --this.arrowShake; } if (this.inGround) { int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); if (j == this.inTile && k == this.inData) { ++this.ticksInGround; if (this.ticksInGround == 1200) { this.setDead(); } } else { this.inGround = false; this.motionX *= this.rand.nextFloat() * 0.2F; this.motionY *= this.rand.nextFloat() * 0.2F; this.motionZ *= this.rand.nextFloat() * 0.2F; this.ticksInGround = 0; this.ticksInAir = 0; } } else { ++this.ticksInAir; Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks_do_do(vec3, vec31, false, true); vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } Entity entity = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int l; float f1; for (l = 0; l < list.size(); ++l) { Entity entity1 = (Entity) list.get(l); if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) { f1 = 0.3F; AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1); MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31); if (movingobjectposition1 != null) { double d1 = vec3.distanceTo(movingobjectposition1.hitVec); if (d1 < d0 || d0 == 0.0D) { entity = entity1; d0 = d1; } } } } if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).func_96122_a(entityplayer)) { movingobjectposition = null; } } float f2; float f3; if (movingobjectposition != null) { if (movingobjectposition.entityHit != null) { f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); int i1 = MathHelper.ceiling_double_int(f2 * this.damage); if (this.getIsCritical()) { i1 += this.rand.nextInt(i1 / 2 + 2); } DamageSource damagesource = null; if (this.shootingEntity == null) { damagesource = DamageSource.causeThrownDamage(this, this); } else { damagesource = DamageSource.causeThrownDamage(this, this.shootingEntity); } if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { movingobjectposition.entityHit.setFire(5); } if (movingobjectposition.entityHit.attackEntityFrom(damagesource, i1)) { if (movingobjectposition.entityHit instanceof EntityLiving) { EntityLiving entityliving = (EntityLiving) movingobjectposition.entityHit; if (!this.worldObj.isRemote) { entityliving.setArrowCountInEntity(entityliving.getArrowCountInEntity() + 1); } if (this.knockbackStrength > 0) { f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); if (f3 > 0.0F) { movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f3, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f3); } } if (this.shootingEntity != null) { EnchantmentThorns.func_92096_a(this.shootingEntity, entityliving, this.rand); } if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(6, 0)); } } this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); if (!(movingobjectposition.entityHit instanceof EntityEnderman)) { this.setDead(); } } else { this.motionX *= -0.10000000149011612D; this.motionY *= -0.10000000149011612D; this.motionZ *= -0.10000000149011612D; this.rotationYaw += 180.0F; this.prevRotationYaw += 180.0F; this.ticksInAir = 0; } } else { this.xTile = movingobjectposition.blockX; this.yTile = movingobjectposition.blockY; this.zTile = movingobjectposition.blockZ; this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.posX -= this.motionX / f2 * 0.05000000074505806D; this.posY -= this.motionY / f2 * 0.05000000074505806D; this.posZ -= this.motionZ / f2 * 0.05000000074505806D; this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.inGround = true; this.arrowShake = 7; this.setIsCritical(false); if (this.inTile != 0) { Block.blocksList[this.inTile].onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this); } } } if (this.getIsCritical()) { for (l = 0; l < 4; ++l) { this.worldObj.spawnParticle("crit", this.posX + this.motionX * l / 4.0D, this.posY + this.motionY * l / 4.0D, this.posZ + this.motionZ * l / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ); } } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { this.prevRotationPitch += 360.0F; } while (this.rotationYaw - this.prevRotationYaw < -180.0F) { this.prevRotationYaw -= 360.0F; } while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { this.prevRotationYaw += 360.0F; } this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; float f4 = 0.99F; f1 = 0.05F; if (this.isInWater()) { for (int j1 = 0; j1 < 4; ++j1) { f3 = 0.25F; this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); } f4 = 0.8F; } this.motionX *= f4; this.motionY *= f4; this.motionZ *= f4; this.motionY -= f1; this.setPosition(this.posX, this.posY, this.posZ); this.doBlockCollisions(); } } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setShort("xTile", (short) this.xTile); par1NBTTagCompound.setShort("yTile", (short) this.yTile); par1NBTTagCompound.setShort("zTile", (short) this.zTile); par1NBTTagCompound.setByte("inTile", (byte) this.inTile); par1NBTTagCompound.setByte("inData", (byte) this.inData); par1NBTTagCompound.setByte("shake", (byte) this.arrowShake); par1NBTTagCompound.setByte("inGround", (byte) (this.inGround ? 1 : 0)); par1NBTTagCompound.setByte("pickup", (byte) this.canBePickedUp); par1NBTTagCompound.setDouble("damage", this.damage); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { this.xTile = par1NBTTagCompound.getShort("xTile"); this.yTile = par1NBTTagCompound.getShort("yTile"); this.zTile = par1NBTTagCompound.getShort("zTile"); this.inTile = par1NBTTagCompound.getByte("inTile") & 255; this.inData = par1NBTTagCompound.getByte("inData") & 255; this.arrowShake = par1NBTTagCompound.getByte("shake") & 255; this.inGround = par1NBTTagCompound.getByte("inGround") == 1; if (par1NBTTagCompound.hasKey("damage")) { this.damage = par1NBTTagCompound.getDouble("damage"); } if (par1NBTTagCompound.hasKey("pickup")) { this.canBePickedUp = par1NBTTagCompound.getByte("pickup"); } else if (par1NBTTagCompound.hasKey("player")) { this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1 : 0; } } /** * Called by a player entity when they collide with an entity */ @Override public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ArcherWeapons.arrowTraining, 1))) { flag = false; } if (flag) { this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } } } /** * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to * prevent them from trampling crops */ @Override protected boolean canTriggerWalking() { return false; } @Override @SideOnly(Side.CLIENT) public float getShadowSize() { return 0.0F; } public void setDamage(double par1) { this.damage = par1; } public double getDamage() { return this.damage; } /** * Sets the amount of knockback the arrow applies when it hits a mob. */ public void setKnockbackStrength(int par1) { this.knockbackStrength = par1; } /** * If returns false, the item will not inflict any damage against entities. */ @Override public boolean canAttackWithItem() { return false; } /** * Whether the arrow has a stream of critical hit particles flying behind it. */ public void setIsCritical(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); if (par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 1))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -2))); } } /** * Whether the arrow has a stream of critical hit particles flying behind it. */ public boolean getIsCritical() { byte b0 = this.dataWatcher.getWatchableObjectByte(16); return (b0 & 1) != 0; } } ItemRPGBow: package rpg.items.archer.weapons; import java.util.List; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ArrowLooseEvent; import net.minecraftforge.event.entity.player.ArrowNockEvent; import rpg.client.entities.projectiles.EntityArrowTraining; import rpg.config.base.archer.ArcherWeapons; import rpg.items.RPGItem; import rpg.lib.Reference; import rpg.playerinfo.PlayerInformation; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemRPGBow extends RPGItem { public ItemRPGBow(int par1, String name) { super(par1, name); this.maxStackSize = 1; this.setMaxDamage(384); this.setCreativeTab(CreativeTabs.tabCombat); } @Override @SuppressWarnings({ "rawtypes", "unchecked" }) public void addInformation(ItemStack par1ItemStack, EntityPlayer player, List par3List, boolean par4) { PlayerInformation playerInfo = PlayerInformation.forPlayer(player); // Checks the players class and colored item name // accordingly if (playerInfo.getPlayersClass().equals("Archer") && player.experienceLevel >= 1) { par3List.add("Class: \u00a7AArcher"); par3List.add("Level: \u00a7A1"); } else if (playerInfo.getPlayersClass().equals("Archer") && player.experienceLevel != 1) { par3List.add("Class: \u00a7AArcher"); par3List.add("Level: \u00a741"); } else if (!playerInfo.getPlayersClass().equals("Archer") && player.experienceLevel == 1) { par3List.add("Class: \u00a74Archer"); par3List.add("Level: \u00a7A1"); } else { par3List.add("Class: \u00a74Archer"); par3List.add("Level: \u00a741"); } } /** * Return the enchantability factor of the item, most of the time is based on material. */ @Override public int getItemEnchantability() { return 1; } /** * returns the action that specifies what animation to play when the items is being used */ @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.bow; } /** * How long it takes to use or consume an item */ @Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 72000; } @Override public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return par1ItemStack; } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { PlayerInformation playerInfo = PlayerInformation.forPlayer(par3EntityPlayer); if (playerInfo.getPlayersClass().equals("Archer")) { ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) return event.result; if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(ArcherWeapons.arrowTraining.itemID)) { par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); } } else { if (playerInfo.getShouldUseMysteriousVoice()) par3EntityPlayer.sendChatToPlayer("\u00a74<Mysterious Voice> Do not try to use the power of a weapon that is not meant for you!"); else par3EntityPlayer.sendChatToPlayer("\u00a74<Dagon> Do not try to use the power of a weapon that is not meant for you!"); } return par1ItemStack; } /** * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount */ @Override public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) { int j = this.getMaxItemUseDuration(par1ItemStack) - par4; ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) return; j = event.charge; boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; if (flag || par3EntityPlayer.inventory.hasItem(ArcherWeapons.arrowTraining.itemID)) { float f = j / 20.0F; f = (f * f + f * 2.0F) / 3.0F; if (f < 0.1D) return; if (f > 1.0F) { f = 1.0F; } EntityArrowTraining entityarrow = new EntityArrowTraining(par2World, par3EntityPlayer, f * 2.0F); if (f == 1.0F) { entityarrow.setIsCritical(true); } int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack); if (k > 0) { entityarrow.setDamage(entityarrow.getDamage() + k * 0.5D + 0.5D); } int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack); if (l > 0) { entityarrow.setKnockbackStrength(l); } if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0) { entityarrow.setFire(100); } par1ItemStack.damageItem(1, par3EntityPlayer); par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); if (flag) { entityarrow.canBePickedUp = 2; } else { par3EntityPlayer.inventory.consumeInventoryItem(ArcherWeapons.arrowTraining.itemID); } if (!par2World.isRemote) { entityarrow.setPosition(par3EntityPlayer.posX, par3EntityPlayer.posY + 2, par3EntityPlayer.posZ); par2World.spawnEntityInWorld(entityarrow); } } } @SideOnly(Side.CLIENT) private Icon[] bowIcons = new Icon[4]; @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconreg) { this.itemIcon = iconreg.registerIcon(Reference.MOD_ID + ":" + this.getUnlocalizedName().substring(5)); for (int i = 1; i < this.bowIcons.length; i++) this.bowIcons[i] = iconreg.registerIcon(Reference.MOD_ID + ":" + this.getUnlocalizedName().substring(5) + "_pull_" + (i - 1)); } @Override public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(player.getItemInUse() == null) return this.itemIcon; int time = stack.getMaxItemUseDuration() - useRemaining; if (time >= 18) return bowIcons[3]; else if (time > 13) return bowIcons[2]; else if (time > 0) return bowIcons[1]; return bowIcons[0]; } } The entity file I believe is a straight copy of the EntityArrow file. Atleast it should be...
  19. The download shouldn't be too big.. But yes, I do like your idea. The only problem I see with that though is that you would need a new folder to be created in say the config folder or somewhere like that so as to avoid people finding to have those new combined textures stored in. I also don't see how the file would be that big download wise. I mean, if you zip it first it should technically not be that big, also reducing the size is the fact that the images are .png's. It shouldn't be that big. It only gets really big if you have at least 200+ items that do this.
  20. He said he did. I'd like to see that setup, though. Okay. Ill show you what I had in a re-create of it. Block code: TileEntityPetEgg petEgg = new TileEntityPetEgg(); @Override /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); boolean isFurnaceAbove = par1World.getBlockId(par2, par3 + 1, par4) == Block.furnaceBurning.blockID; boolean isFurnaceBelow = par1World.getBlockId(par2, par3 - 1, par4) == Block.furnaceBurning.blockID; boolean isFurnaceLeft = par1World.getBlockId(par2 - 1, par3, par4) == Block.furnaceBurning.blockID; boolean isFurnaceRight = par1World.getBlockId(par2 + 1, par3, par4) == Block.furnaceBurning.blockID; boolean isFurnaceInFront = par1World.getBlockId(par2, par3, par4 + 1) == Block.furnaceBurning.blockID; boolean isFurnaceBehind = par1World.getBlockId(par2, par3, par4 - 1) == Block.furnaceBurning.blockID; boolean isFurnaceAboveOrBelow = isFurnaceAbove && isFurnaceBelow; boolean isFurnaceLeftOrRight = isFurnaceLeft && isFurnaceRight; boolean isFurnaceInFrontOrBehind = isFurnaceInFront && isFurnaceBehind; boolean furnaceIsNearby = isFurnaceAboveOrBelow && isFurnaceLeftOrRight && isFurnaceInFrontOrBehind; if(furnaceIsNearby) { this.petEgg.canIncubate = true; } } @Override /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor blockID */ // This is the method to use to see if a furnace has been placed so that the egg can be incubated public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); boolean isFurnaceAbove = par1World.getBlockId(par2, par3 + 1, par4) == Block.furnaceBurning.blockID; boolean isFurnaceBelow = par1World.getBlockId(par2, par3 - 1, par4) == Block.furnaceBurning.blockID; boolean isFurnaceLeft = par1World.getBlockId(par2 - 1, par3, par4) == Block.furnaceBurning.blockID; boolean isFurnaceRight = par1World.getBlockId(par2 + 1, par3, par4) == Block.furnaceBurning.blockID; boolean isFurnaceInFront = par1World.getBlockId(par2, par3, par4 + 1) == Block.furnaceBurning.blockID; boolean isFurnaceBehind = par1World.getBlockId(par2, par3, par4 - 1) == Block.furnaceBurning.blockID; boolean isFurnaceAboveOrBelow = isFurnaceAbove && isFurnaceBelow; boolean isFurnaceLeftOrRight = isFurnaceLeft && isFurnaceRight; boolean isFurnaceInFrontOrBehind = isFurnaceInFront && isFurnaceBehind; boolean furnaceIsNearby = isFurnaceAboveOrBelow && isFurnaceLeftOrRight && isFurnaceInFrontOrBehind; if(furnaceIsNearby) { this.petEgg.canIncubate = true; } } Those were the two methods I used, but the System.out wasn't appearing in my console whenever there was a lit furnace next to it.
  21. I thought that would be the case Oh well, some If you want to make it more interesting like that, make a model for the item and make ALL the extensions included in that one model, then have if statements around each extension checking to see if that extension is installed. That would be how I would do it. You may have to look into texture manipulating...
  22. I am not entirely sure that there is a way to "merge" textures in such a way that it allows you to create new ones via code. You will have to have a texture for each individual item upgrade that you want to be avaliable. Then, you have maybe an integer, lets call it for the sake of this tutorial, textureID. You also need a Icon list, say its called upgradeIcons (all names will become a bit clearer in the code). So textureID is default to 0. So say I put an upgrade on it, the icon for the (say its a sword) that particular upgrade is a paxel texture. Lets also say that that icon has the textureID of 1. So when the player upgrades the item to that paxel, the textureID also gets set to 1 displaying the correct texture. Simplified version would be this (in my simplified code, there will only be one upgrade. And I am also assuming that you have a way of saving data about the item in the form of NBT, so create the needed things for textureID to be stored in the items NBT data). The code: // your item code blah blah blah @SideOnly(Side.CLIENT) private Icon[] upgradeIcons = new Icon[2]; private int textureID = 0; @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { // Register each Icon here BEFORE the switch statement. this.upgradeIcons[0] = par1IconRegister.registerIcon("MOD_ID:" + this.getUnlocalizedName().substring(5); this.upgradeIcons[1] = par1IconRegister.registerIcon("MOD_ID:" + this.getUnlocalizedName().substring(5) + "Paxel"; // You should get the gist of this switch statement switch(this.textureID) { case 1: this.itemIcon = this.upgradeIcons[1]; break; default: this.itemIcon = this.upgradeIcons[0]; break; } } // rest of your item code blah blah blah Hopefully that helps, but it may not quite be what your looking for, if its not, well then. I wasted some of my life
  23. As the title slightly states, I want my tile entity that is connected to my "egg" block to start incubating when there is a lit furnace nearby (within one block that is directly touching it, it is shown in the code below). I have tried using the same code (with a few exceptions to some parts) in the block file in onBlockAddedToWorld() [i am pretty sure that's what its called] and onNeighbourChange() [or whatever it is called] and it didn't seem to set the set the egg incubating. That reminds me, I may have stuffed my incubating handler, so I will include that too. Incubating Handler: package rpg.handlers.events; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingEvent; import rpg.blocks.tileentity.TileEntityPetEgg; import rpg.network.packet.PacketSpawnPet; public class IncubatorHandler { @ForgeSubscribe public void incubateEgg(LivingEvent event){ TileEntityPetEgg petEgg = new TileEntityPetEgg(); if(petEgg.canIncubate) { int timer = petEgg.getIncubatingTimer(); timer++; if (timer >= petEgg.getIncubationTime()) { new PacketSpawnPet(event.entity.worldObj, petEgg.petType).sendToServer(); System.out.println("Incubation finishes in: " + timer + "EntityPlayer Updates"); } if(timer == petEgg.getIncubationTime()) { petEgg.setIncubatingTimer(0); } } } } TileEntityPetEgg (the tile entity in question) package rpg.blocks.tileentity; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import rpg.blocks.BlockPetEgg; import rpg.pet.EnumPetType; public class TileEntityPetEgg extends TileEntity { public boolean canIncubate = false; public int incubatingTimer = 0; public EnumPetType petType; public TileEntityPetEgg() { this.petType = BlockPetEgg.petType; } /** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count * ticks and creates a new spawn inside its implementation. */ public void updateEntity() { boolean isFurnaceAbove = this.worldObj.getBlockId(this.xCoord, this.yCoord + 1, this.zCoord) == Block.furnaceBurning.blockID; boolean isFurnaceBelow = this.worldObj.getBlockId(this.xCoord, this.yCoord - 1, this.zCoord) == Block.furnaceBurning.blockID; boolean isFurnaceLeft = this.worldObj.getBlockId(this.xCoord - 1, this.yCoord, this.zCoord) == Block.furnaceBurning.blockID; boolean isFurnaceRight = this.worldObj.getBlockId(this.xCoord + 1, this.yCoord, this.zCoord) == Block.furnaceBurning.blockID; boolean isFurnaceInFront = this.worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord + 1) == Block.furnaceBurning.blockID; boolean isFurnaceBehind = this.worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord - 1) == Block.furnaceBurning.blockID; boolean isFurnaceAboveOrBelow = isFurnaceAbove && isFurnaceBelow; boolean isFurnaceLeftOrRight = isFurnaceLeft && isFurnaceRight; boolean isFurnaceInFrontOrBehind = isFurnaceInFront && isFurnaceBehind; boolean furnaceIsNearby = isFurnaceAboveOrBelow && isFurnaceLeftOrRight && isFurnaceInFrontOrBehind; if(furnaceIsNearby) { this.canIncubate = true; } } public int getIncubationTime() { return BlockPetEgg.incubationTime; } @Override public void writeToNBT(NBTTagCompound par1NBTTag) { super.writeToNBT(par1NBTTag); par1NBTTag.setBoolean("canIncubate", canIncubate); par1NBTTag.setInteger("incubatingTimer", incubatingTimer); } @Override public void readFromNBT(NBTTagCompound par1NBTTag) { super.readFromNBT(par1NBTTag); canIncubate = par1NBTTag.getBoolean("canIncubate"); incubatingTimer = par1NBTTag.getInteger("incubatingTimer"); } public int getIncubatingTimer() { return this.incubatingTimer; } public int setIncubatingTimer(int newTime) { if(this.incubatingTimer != newTime) this.incubatingTimer = newTime; return this.incubatingTimer; } } That should be all. There is no code in the block file anymore that has anything to do with the incubating of it. The only code that is to do with the TileEntityPetEgg is the registering it and such.
  24. Just by reading through your armor file, you are using a null object as the model, that is why it isn't working... So maybe try this instead: package MHF.Item.Armor; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraftforge.client.IItemRenderer; import MHF.Renderer.*; public class Body_premiumArmor_1 extends ItemArmor{ private RenderFUCDeluxeArmor RenderFUCDeluxeArmor; public Body_premiumArmor_1(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { super(par1, par2EnumArmorMaterial, par3, par4); } @Override public ModelBiped getArmorModel(EntityLiving entityLiving, ItemStack itemStack, int armorSlot) { return new MHF.Model.ModelItemFUCDeluxeArmorBody(); } }

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.