mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
fortune support for ores, implemented mining plastic explosives (c4&sem)
This commit is contained in:
parent
717a947b53
commit
9477cf8b68
@ -1,9 +1,15 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.explosion.vanillant.BlockAllocatorStandard;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockChargeC4 extends BlockChargeBase {
|
||||
@ -16,8 +22,9 @@ public class BlockChargeC4 extends BlockChargeBase {
|
||||
world.setBlockToAir(x, y, z);
|
||||
safe = false;
|
||||
|
||||
ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 10F).makeStandard();
|
||||
xnt.setBlockAllocator(new BlockAllocatorStandard(64));
|
||||
ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 15F).makeStandard();
|
||||
xnt.setBlockAllocator(new BlockAllocatorStandard(32));
|
||||
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop());
|
||||
xnt.explode();
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
@ -32,4 +39,10 @@ public class BlockChargeC4 extends BlockChargeBase {
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
super.addInformation(stack, player, list, ext);
|
||||
list.add(EnumChatFormatting.BLUE + "Does not drop blocks.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,15 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import com.hbm.explosion.ExplosionLarge;
|
||||
import com.hbm.explosion.ExplosionNT;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockChargeSemtex extends BlockChargeBase {
|
||||
@ -14,9 +21,14 @@ public class BlockChargeSemtex extends BlockChargeBase {
|
||||
safe = true;
|
||||
world.setBlockToAir(x, y, z);
|
||||
safe = false;
|
||||
ExplosionNT exp = new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 4F);
|
||||
exp.explode();
|
||||
ExplosionLarge.spawnParticles(world, x + 0.5, y + 0.5, z + 0.5, 20);
|
||||
|
||||
ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 10F);
|
||||
xnt.setBlockAllocator(new BlockAllocatorStandard(32));
|
||||
xnt.setBlockProcessor(new BlockProcessorStandard()
|
||||
.setAllDrop()
|
||||
.setFortune(3));
|
||||
xnt.setSFX(new ExplosionEffectStandard());
|
||||
xnt.explode();
|
||||
|
||||
return BombReturnCode.DETONATED;
|
||||
}
|
||||
@ -28,4 +40,13 @@ public class BlockChargeSemtex extends BlockChargeBase {
|
||||
public int getRenderType() {
|
||||
return BlockChargeC4.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
super.addInformation(stack, player, list, ext);
|
||||
list.add(EnumChatFormatting.BLUE + "Will drop all blocks.");
|
||||
list.add(EnumChatFormatting.BLUE + "Does not do damage.");
|
||||
list.add(EnumChatFormatting.BLUE + "");
|
||||
list.add(EnumChatFormatting.LIGHT_PURPLE + "Fortune III");
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,4 +55,16 @@ public class BlockDepthOre extends BlockDepth {
|
||||
|
||||
return super.quantityDropped(rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDroppedWithBonus(int fortune, Random rand) {
|
||||
|
||||
int mult = rand.nextInt(fortune + 2) - 1;
|
||||
|
||||
if(mult < 0) {
|
||||
mult = 0;
|
||||
}
|
||||
|
||||
return this.quantityDropped(rand) * (mult + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,6 +240,22 @@ public class BlockOre extends Block {
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDroppedWithBonus(int fortune, Random rand) {
|
||||
|
||||
if(fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, rand, fortune)) {
|
||||
int mult = rand.nextInt(fortune + 2) - 1;
|
||||
|
||||
if(mult < 0) {
|
||||
mult = 0;
|
||||
}
|
||||
|
||||
return this.quantityDropped(rand) * (mult + 1);
|
||||
} else {
|
||||
return this.quantityDropped(rand);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int p_149692_1_) {
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
/**
|
||||
* Now it's getting ridiculously over-engineered
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
public class DropChanceAlways implements IDropChanceMutator {
|
||||
|
||||
@Override
|
||||
public float mutateDropChance(ExplosionVNT explosion, Block block, int x, int y, int z, float chance) {
|
||||
return 1F;
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class DropChanceNever implements IDropChanceMutator {
|
||||
|
||||
@Override
|
||||
public float mutateDropChance(ExplosionVNT explosion, Block block, int x, int y, int z, float chance) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,17 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.explosion.vanillant.interfaces.IBlockAllocator;
|
||||
import com.hbm.explosion.vanillant.interfaces.IBlockProcessor;
|
||||
import com.hbm.explosion.vanillant.interfaces.IEntityProcessor;
|
||||
import com.hbm.explosion.vanillant.interfaces.IExplosionSFX;
|
||||
import com.hbm.explosion.vanillant.interfaces.IPlayerProcessor;
|
||||
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.BlockProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.EntityProcessorStandard;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard;
|
||||
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.Vec3;
|
||||
@ -30,7 +41,7 @@ public class ExplosionVNT {
|
||||
protected double posX;
|
||||
protected double posY;
|
||||
protected double posZ;
|
||||
protected float size;
|
||||
public float size;
|
||||
public Entity exploder;
|
||||
|
||||
private Map compatPlayers = new HashMap();
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
public interface IBlockMutator {
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
@ -1,4 +1,6 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.interfaces;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
@ -1,7 +1,10 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.IBlockAllocator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@ -1,8 +1,14 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.IBlockMutator;
|
||||
import com.hbm.explosion.vanillant.interfaces.IBlockProcessor;
|
||||
import com.hbm.explosion.vanillant.interfaces.IDropChanceMutator;
|
||||
import com.hbm.explosion.vanillant.interfaces.IFortuneMutator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
@ -79,11 +85,20 @@ public class BlockProcessorStandard implements IBlockProcessor {
|
||||
}
|
||||
|
||||
public BlockProcessorStandard setNoDrop() {
|
||||
this.chance = new DropChanceNever();
|
||||
this.chance = new DropChanceMutatorStandard(0F);
|
||||
return this;
|
||||
}
|
||||
public BlockProcessorStandard setAllDrop() {
|
||||
this.chance = new DropChanceAlways();
|
||||
this.chance = new DropChanceMutatorStandard(1F);
|
||||
return this;
|
||||
}
|
||||
public BlockProcessorStandard setFortune(int fortune) {
|
||||
this.fortune = new IFortuneMutator() { //no standard class because we only have one case thus far
|
||||
@Override
|
||||
public int mutateFortune(ExplosionVNT explosion, Block block, int x, int y, int z) {
|
||||
return fortune;
|
||||
}
|
||||
};
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.IDropChanceMutator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class DropChanceMutatorStandard implements IDropChanceMutator {
|
||||
|
||||
private float chance;
|
||||
|
||||
public DropChanceMutatorStandard(float chance) {
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float mutateDropChance(ExplosionVNT explosion, Block block, int x, int y, int z, float chance) {
|
||||
return this.chance;
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,11 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.IEntityProcessor;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentProtection;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -1,7 +1,9 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.IExplosionSFX;
|
||||
import com.hbm.packet.ExplosionVanillaNewTechnologyCompressedAffectedBlockPositionDataForClientEffectsAndParticleHandlingPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.hbm.explosion.vanillant;
|
||||
package com.hbm.explosion.vanillant.standard;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
import com.hbm.explosion.vanillant.interfaces.IPlayerProcessor;
|
||||
import com.hbm.packet.ExplosionKnockbackPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
@ -50,7 +50,7 @@ import com.hbm.entity.mob.botprime.*;
|
||||
import com.hbm.entity.mob.siege.*;
|
||||
import com.hbm.entity.particle.*;
|
||||
import com.hbm.entity.projectile.*;
|
||||
import com.hbm.explosion.vanillant.ExplosionEffectStandard;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard;
|
||||
import com.hbm.handler.HbmKeybinds;
|
||||
import com.hbm.handler.HbmKeybinds.EnumKeybind;
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.explosion.vanillant.ExplosionEffectStandard;
|
||||
import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user