-
Posts
169 -
Joined
-
Last visited
Posts posted by jordsta95
-
-
Same way that you'd spawn any other ore. Just check for your dimension ID in your IWorldGenerator.
So if this is the nether
case 1:
generateNether(world, random, chunkX * 16, chunkZ * 16);
then
case Main.dimensionID:
generateDim(world, random, chunkX * 16, chunkZ * 16);
?
-
Hey there, I want to make an ore only spawn in a custom dimension"Main.dimensionID" how would I make it so that I spawn something there?
I haven't messed with anything other than vanilla dimensions before
-
Is it possible to make it so that when a piece of armour is worn it will take damage?
I am putting together a pack that utilizes hardcore darkness, and I am making some armour that when worn will give night vision effects. Only issue is players can abuse these, as they will last forever, and that's not the idea of the pack. So I think the best way to balance these bits of armour would be to make it so when they are worn every 30 seconds, or so, the armour will take a bit of damage. That way the player doesn't make a one off investment in this, and it can last them until end-game.
-
The && operator exists.
Thanks for your help
-
So separate out the or statements into multiple if statements?
That way it would be:
if slot 1 != null{
}
if slot 2 != null {
}
if slot 3 != null{
}
if slot 4 != null{
}
Or am I going about this the wrong way?
-
Hey there, so I haven't really messed around with potion effects before, and I have this set of armour which works perfectly, until you come to remove it...
Here is the code:
public class BedrockArmour extends ItemArmor { public BedrockArmour(ArmorMaterial material, int armorType) { super(material, 0, armorType); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if(stack.getItem() == itemRegist.bedrockChest || stack.getItem() == itemRegist.bedrockHelmet || stack.getItem() == itemRegist.bedrockBoots) { return Reference.MODID + ":models/armor/bedrock_layer_1.png"; } else if(stack.getItem() == itemRegist.bedrockLegs) { return Reference.MODID + ":models/armor/bedrock_layer_2.png"; } else{ System.out.println("Invalid Item for Bedrock Armour"); return null; } } public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if(player.getCurrentArmor(3) != null || player.getCurrentArmor(2) != null || player.getCurrentArmor(1) != null || player.getCurrentArmor(0) != null){ ItemStack helmet2 = player.getCurrentArmor(3); ItemStack plate2 = player.getCurrentArmor(2); ItemStack legs2 = player.getCurrentArmor(1); ItemStack boots = player.getCurrentArmor(0); if(helmet2.getItem() == itemRegist.bedrockHelmet || legs2.getItem() == itemRegist.bedrockLegs || plate2.getItem() == itemRegist.bedrockChest || boots.getItem() == itemRegist.bedrockBoots){ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 0)); } } if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null || player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null || player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null || player.getCurrentArmor(1) != null && player.getCurrentArmor(0) != null || player.getCurrentArmor(0) != null && player.getCurrentArmor(2) != null || player.getCurrentArmor(3) != null && player.getCurrentArmor(0) != null){ ItemStack helmet2 = player.getCurrentArmor(3); ItemStack plate2 = player.getCurrentArmor(2); ItemStack legs2 = player.getCurrentArmor(1); ItemStack boots = player.getCurrentArmor(0); if(helmet2.getItem() == itemRegist.bedrockHelmet && plate2.getItem() == itemRegist.bedrockChest || plate2.getItem() == itemRegist.bedrockChest && legs2.getItem() == itemRegist.bedrockLegs || helmet2.getItem() == itemRegist.bedrockHelmet && plate2.getItem() == itemRegist.bedrockChest || legs2.getItem() == itemRegist.bedrockLegs && boots.getItem() == itemRegist.bedrockBoots || boots.getItem() == itemRegist.bedrockBoots && plate2.getItem() == itemRegist.bedrockChest || helmet2.getItem() == itemRegist.bedrockHelmet && boots.getItem() == itemRegist.bedrockBoots) { player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 1)); player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 0)); } } if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null || player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(0) != null || player.getCurrentArmor(3) != null && player.getCurrentArmor(1) != null && player.getCurrentArmor(0) != null || player.getCurrentArmor(1) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(0) != null){ ItemStack helmet2 = player.getCurrentArmor(3); ItemStack plate2 = player.getCurrentArmor(2); ItemStack legs2 = player.getCurrentArmor(1); ItemStack boots = player.getCurrentArmor(0); if(helmet2.getItem() == itemRegist.bedrockHelmet && plate2.getItem() == itemRegist.bedrockChest && legs2.getItem() == itemRegist.bedrockLegs || helmet2.getItem() == itemRegist.bedrockHelmet && plate2.getItem() == itemRegist.bedrockChest && boots.getItem() == itemRegist.bedrockBoots || helmet2.getItem() == itemRegist.bedrockHelmet && legs2.getItem() == itemRegist.bedrockLegs && boots.getItem() == itemRegist.bedrockBoots || legs2.getItem() == itemRegist.bedrockLegs && plate2.getItem() == itemRegist.bedrockChest && boots.getItem() == itemRegist.bedrockBoots){ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 2)); player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 1)); } } if(player.getCurrentArmor(1) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(0) != null && player.getCurrentArmor(3) != null ){ ItemStack helmet2 = player.getCurrentArmor(3); ItemStack plate2 = player.getCurrentArmor(2); ItemStack legs2 = player.getCurrentArmor(1); ItemStack boots = player.getCurrentArmor(0); if(legs2.getItem() == itemRegist.bedrockLegs && plate2.getItem() == itemRegist.bedrockChest && boots.getItem() == itemRegist.bedrockBoots && helmet2.getItem() == itemRegist.bedrockHelmet){ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 3)); player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 2)); } } } }
Here's a copy of the crashlog:
This crash happens when:
The armour isn't added (whether placed or shift clicked) in the order - Helmet, Chest, Legs, Boots
Armour is removed (via mouse or shift click) in an order that isn't - Boots, Legs, Chest, Helmet
If it is because of the very messy code, then ideas on how to fix it would be greatly appreciated.
-
Pardon my ignorance, I just realized where I have been going wrong. Sorry about that.
-
I know that. As I said, when they are wearing more stuff they get more effects... which is in the code that I posted...
-
Hey there, I was wondering what I am doing wrong. I have tried both:
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null){ ItemStack helmet = player.getCurrentArmor(3); ItemStack plate = player.getCurrentArmor(2); ItemStack legs = player.getCurrentArmor(1); if(helmet.getItem() == itemRegist.bedrockHelmet && plate.getItem() == itemRegist.bedrockChest && legs.getItem() == itemRegist.bedrockLegs){ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 2)); player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 1)); } else if(helmet.getItem() == itemRegist.bedrockHelmet && plate.getItem() == itemRegist.bedrockChest){ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 1)); player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 0)); } else if(helmet.getItem() == itemRegist.bedrockHelmet){ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 0)); } }
and:
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null){ ItemStack helmet = player.getCurrentArmor(3); ItemStack plate = player.getCurrentArmor(2); ItemStack legs = player.getCurrentArmor(1); if(helmet.getItem() == itemRegist.bedrockHelmet){ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 0)); } else if(helmet.getItem() == itemRegist.bedrockHelmet && plate.getItem() == itemRegist.bedrockChest){ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 1)); player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 0)); } else if(helmet.getItem() == itemRegist.bedrockHelmet && plate.getItem() == itemRegist.bedrockChest && legs.getItem() == itemRegist.bedrockLegs){ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 5, 2)); player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 5, 1)); } } }
And neither do what I am looking for.
I want it so when a player is wearing one piece of armour (that isn't boots) they get slowness one (and yes, I left out the ors for when there are less 2 or 1 items being worn, I just wanted to test), when they wear 2 they get slowness 2 and resistance 1, and when they wear all 3 they gets slowness 3 resistance 2.
With the first code it only works on the helmet being worn - giving slowness 1
With the second code it only works when everything is worn - giving slowness 3, resistance 2.
I never really messed with customizing armour and potion effects, any pointers on how to achieve this goal?
-
Hey there, I don't know if this is possible or not, but is it possible to make it so that when a player kills another player the player that has been killed will drop an item, like a mob.
I am working on a PVPesc mod, and to get some some of the end game stuff I want to "force" PvP by making it so that to get the end-game stuff you have to kill players.
So when you kill a player the player will drop their inventory (if keepInventory is false) along with this item(s).
Is this possible, if so how? I have never really messed with hooking mob drops, let alone player drops.
-
Hey there, I am having issues with a custom dimension.
Seeing as the mod is more for personal use I am not looking for a fancy portal, just a "nether portal" that uses a different block instead of obsidian.
I followed a few tutorials and I got the dimension to "work" but I am having a few issues.
1) The new dimension replicates the overworld almost perfectly... when I specified it to spawn a single custom biome
2) When I enter the dimension it creates a nether portal, when you go through that you go to the overworld, but enter the newly created nether portal, it goes to the nether.
3) The portal doesn't actually work. I place the block I set (temporarily) called endOre in the shape of a basic nether portal. And light it, but it doesn't work.
I have the whole code here on GitHub if anyone needs to look at it
https://github.com/jordsta95/JordnElecsUtils/tree/master/src/main/java/com/jordsta/stuff/dimensions
Thanks in advance for any help you can give.
-
The method is called onBlockActivated. I suggest you use your IDE to override it.
So I do:
void onBlockActivated(){
?
}
What do I need to put in here?
Eclipse told me to remove the @Override when I tried to add it...
-
Alright, I got this far, but I don't really know where to go from here
(I have never done more than basic blocks/items/tools/armour)
package com.jordsta.stuff.blocks; import com.jordsta.stuff.JordTab; import com.jordsta.stuff.Reference; import com.jordsta.stuff.helpers.RegisterHelper; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class cobbleGen extends Block { public cobbleGen() { super(Material.rock); setBlockName("cobbleGen"); setBlockTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5)); setCreativeTab(JordTab.JordTab); setHardness(4.0f); setResistance(4.0f); RegisterHelper.registerBlock(this); } void onBlockClicked(){ } }
I put void as that is what eclipse told me to do.
I looked at mob spawner code to try and figure out what I am supposed to do, but I have no idea how to read the messy code that is Minecraft. That, and it makes no sense
-
Hey there, I wanted to make a block which is essentially a cobble generator (for reasons), and I was going to do this by making a block that when right clicked it would spit out a cobblestone block.
Does anyone have any idea how I might be able to do this?
-
You want to override
getHarvestLevel(stack, toolClass)
,
getToolClasses(stack)
and
getDigSpeed(stack, block, meta)
in your tool. Then you do not even need to extend ItemTool.
OMG! So much easier than trying to mess with the stupid ItemTool (spent 30 minutes smashing my head into my monitor while getting it to play ball) Thank you
-
Hey there, I was wondering how to make a multi-tool that harvests anything that needs the right tool.
If I remember correctly you have to do:
public static final Block[] blocksEffectiveAgainst = new Block[] {BLOCKS};
But that means it wouldn't work on anything from other mods, right?
If that is the case how would I make it so a tool works with any mod's blocks that are of the right tool material (e.g. a multi-tool that is a pickaxe and a shovel work properly with copper ore, marble, and cursed earth, for example)
-
Hey there, so I am having an issue with some special armour.
I want it to only get "bypassed" by 1 weapon, and that one weapon does "bypass" it, but it always kills, no matter what I have tried to lessen the blow:
@Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { if (source.isExplosion()) { return new ArmorProperties(1, 1.0D, (int) 105.7); } if (source.setDamageBypassesArmor() != null) { return new ArmorProperties(1, 1.0D, 500); } if (source.equals(itemRegist.moneyBlade)) { return new ArmorProperties(1, 1.0D, 500000); } if (source.causeMobDamage(player) != null) { return new ArmorProperties(1, 1.0D, (int) 105.7); } if (source.wither != null) { return new ArmorProperties(1, 1.0D, 500); } if (source.canHarmInCreative()) { return new ArmorProperties(1, 1.0D, (int) 100); } if (source.causePlayerDamage(null) != null) { return new ArmorProperties(1, 1.0D, (int) 100); } if (slot == 0 || slot == 3) { return new ArmorProperties(0, 0.2D, 250); } return new ArmorProperties(0, 0.3D, 350); }
So the sword in question is "itemRegist.moneyBlade" which normally does +250 attack damage (definitely not OP, I know) but I wanted to reduce it so when a player is wearing this set of armour it only does 5 hearts (or so)
As you can see on the "source.isExplosion" line I have been messing around with numbers trying to make stuff perfect but with the sword attacking, I can't seem to even stop it killing the player (hence the massive number, hoping to at least block all damage, and work it out from there)
Any idea on what would be a good way to sort this out. (also a link to how those numbers affect damage would be nice, it took an hour to get that number for the explosion damge - 105 did 1 heart, 106 did 0 hearts, WTF!)
-
Hey guys, so I am trying to make a block players can walk through but I am having a few issues.
1) If inside the block, the player takes suffocation damage
2) When walking through a single block at feet level, no issues, but when trying to walk through at head level, either momentum is needed, or some sides don't seem work.
Anything you could suggest, here is an example of of the blocks:
public class secretDirt extends Block { public secretDirt(){ super(Material.grass); setBlockName("secretDirt"); setCreativeTab(JordTab.JordTab); RegisterHelper.registerBlock(this); } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon("minecraft:dirt"); } }
-
Hey guys,
So I have an an armour which can be bypassed by stuff like the rapier from TiCon, but I want to make an upgraded version that removes that possibility.
Something like KAMI armour from Thaumic Tinkerer.
How would one go about doing this?
-
Hey there, I have taken some code from an old mod, and almost everything works apart from 1 thing
Old code:
public class EntitySafePearl extends EntityThrowable { public EntitySafePearl(World par1World) { super(par1World); } public EntitySafePearl(World par1World, EntityLiving par2EntityLiving) { super(par1World, par2EntityLiving); } @SideOnly(Side.CLIENT) public EntitySafePearl(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); } /** * Called when this EntityThrowable hits a block or entity. */ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null) { par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0); } for (int var2 = 0; var2 < 32; ++var2) { this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian()); } if (!this.worldObj.isRemote) { if (this.getThrower() != null && this.getThrower() instanceof EntityPlayerMP) { EntityPlayerMP var3 = (EntityPlayerMP)this.getThrower(); if (!var3.playerNetServerHandler.connectionClosed && var3.worldObj == this.worldObj) { this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ); this.getThrower().fallDistance = 0.0F; } } this.setDead(); } }
Code that no longer works:
var3.playerNetServerHandler.connectionClosed
more specifically the "connectionClosed"
Just wondering what is wrong with it? (I know it used to work)
-
-Break statement missing
-Actual generation lines missing
-Swapped dimension id between End/Nether
That makes no sense to me whatsoever
(I am new to modding, just adding a few basic things)
-
Hey there, so I have end ore generation to work. But I can't get nether ore gen to work this is how I have my code set up:
package com.jordsta.stuff.world; import com.jordsta.stuff.init.blockRegist; import cpw.mods.fml.common.IWorldGenerator; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import java.util.Random; public class superiumOreGen implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId){ case 1: generateNether(world, random, chunkX * 16, chunkZ * 16); case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); case -1: generateEnd(world, random, chunkX * 16, chunkZ * 16); } } private void generateEnd(World world, Random random, int chunkX, int chunkZ) { for(int i = 0; i < 60; i++){ int xCoord = chunkX + random.nextInt(16); int yCoord = random.nextInt(60); int zCoord = chunkZ + random.nextInt(16); } } private void generateSurface(World world, Random random, int chunkX, int chunkZ) { for(int i = 0; i < 60; i++){ int xCoord = chunkX + random.nextInt(16); int yCoord = random.nextInt(60); int zCoord = chunkZ + random.nextInt(16); } } private void generateNether(World world, Random random, int chunkX, int chunkZ) { for(int i = 0; i < 60; i++){ int xCoord = chunkX + random.nextInt(16); int yCoord = random.nextInt(60); int zCoord = chunkZ + random.nextInt(16); (new WorldGenMinable(blockRegist.superiumOre, 40, Blocks.netherrack)).generate(world, random, xCoord, yCoord, zCoord); } } }
*set to 40 just so I can find it easily... but it doesn't spawn at all
This is the code in the main class:
GameRegistry.registerWorldGenerator(new superiumOreGen(), 1);
Is there anything I am doing wrong?
-
Alright, thanks
-
So instead of doing:
setBlockTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5));
I do:
getItemIconName(MainClass.<item>); ?
Or what?
I don't want the block to have any textures, just that it should have a texture in the inventory....
[1.7.10] Ore spawn
in Modder Support
Posted
As I said, I don't know how to do dimension stuff, so I am sorta stumped on this. I tried doing this, only to have the game crash: