yeah whatever

This commit is contained in:
Bob 2022-01-06 00:24:55 +01:00
parent 05b6d9b95a
commit 49a07b6b74
21 changed files with 622 additions and 184 deletions

View File

@ -9,6 +9,7 @@ public interface IToolable {
public static enum ToolType {
SCREWDRIVER,
HAND_DRILL
HAND_DRILL,
DEFUSER
}
}

View File

@ -4,7 +4,10 @@ import com.hbm.lib.RefStrings;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockBase extends Block {
@ -25,6 +28,10 @@ public class BlockBase extends Block {
return this;
}
/**
* Daisychainable setter for making the block a beacon base block
* @return
*/
public BlockBase setBeaconable() {
this.beaconable = true;
return this;
@ -34,4 +41,31 @@ public class BlockBase extends Block {
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
return this.beaconable;
}
/**
* Sets the block to air and drops it
* @param world
* @param x
* @param y
* @param z
*/
public void dismantle(World world, int x, int y, int z) {
world.setBlockToAir(x, y, z);
ItemStack itemstack = new ItemStack(this, 1);
float f = world.rand.nextFloat() * 0.6F + 0.2F;
float f1 = world.rand.nextFloat() * 0.2F;
float f2 = world.rand.nextFloat() * 0.6F + 0.2F;
EntityItem entityitem = new EntityItem(world, x + f, y + f1 + 1, z + f2, itemstack);
float f3 = 0.05F;
entityitem.motionX = (float) world.rand.nextGaussian() * f3;
entityitem.motionY = (float) world.rand.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float) world.rand.nextGaussian() * f3;
if(!world.isRemote)
world.spawnEntityInWorld(entityitem);
}
}

View File

@ -0,0 +1,26 @@
package com.hbm.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public abstract class BlockContainerBase extends BlockBase implements ITileEntityProvider {
protected BlockContainerBase(Material material) {
super(material);
this.isBlockContainer = true;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
super.breakBlock(world, x, y, z, block, meta);
world.removeTileEntity(x, y, z);
}
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventNo, int eventArg) {
super.onBlockEventReceived(world, x, y, z, eventNo, eventArg);
TileEntity tileentity = world.getTileEntity(x, y, z);
return tileentity != null ? tileentity.receiveClientEvent(eventNo, eventArg) : false;
}
}

View File

@ -2662,7 +2662,6 @@ public class ModBlocks {
GameRegistry.registerBlock(bomb_multi, bomb_multi.getUnlocalizedName());
GameRegistry.registerBlock(crashed_balefire, crashed_balefire.getUnlocalizedName());
GameRegistry.registerBlock(fireworks, fireworks.getUnlocalizedName());
//GameRegistry.registerBlock(bomb_multi_large, bomb_multi_large.getUnlocalizedName());
//Turrets
GameRegistry.registerBlock(turret_light, turret_light.getUnlocalizedName());
@ -2684,6 +2683,9 @@ public class ModBlocks {
GameRegistry.registerBlock(turret_fritz, turret_fritz.getUnlocalizedName());
GameRegistry.registerBlock(turret_brandon, turret_brandon.getUnlocalizedName());
//Wall-mounted Explosives
GameRegistry.registerBlock(charge_dynamite, charge_dynamite.getUnlocalizedName());
//Mines
GameRegistry.registerBlock(mine_ap, mine_ap.getUnlocalizedName());
GameRegistry.registerBlock(mine_he, mine_he.getUnlocalizedName());

View File

@ -10,12 +10,16 @@ import static net.minecraftforge.common.util.ForgeDirection.WEST;
import com.hbm.blocks.BlockBase;
import com.hbm.interfaces.IBomb;
import api.hbm.block.IToolable;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class BlockChargeBase extends BlockBase implements IBomb {
public abstract class BlockChargeBase extends BlockBase implements IBomb, IToolable {
public BlockChargeBase() {
super(Material.tnt);
@ -47,8 +51,44 @@ public abstract class BlockChargeBase extends BlockBase implements IBomb {
(dir == EAST && world.isSideSolid(x - 1, y, z, EAST));
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
if(!world.isSideSolid(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ, dir)) {
world.setBlockToAir(x, y, z);
this.explode(world, x, y, z);
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
float f = 0.0625F;
switch(world.getBlockMetadata(x, y, z)) {
case 0: this.setBlockBounds(0.0F, 10 * f, 0.0F, 1.0F, 1.0F, 1.0F); break;
case 1: this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 6 * f, 1.0F); break;
case 2: this.setBlockBounds(0.0F, 0.0F, 10 * f, 1.0F, 1.0F, 1.0F); break;
case 3: this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 6 * f); break;
case 4: this.setBlockBounds(10 * f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); break;
case 5: this.setBlockBounds(0.0F, 0.0F, 0.0F, 6 * f, 1.0F, 1.0F); break;
}
}
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
if(tool != ToolType.DEFUSER)
return false;
this.dismantle(world, x, y, z);
return true;
}
}

View File

@ -1,11 +1,34 @@
package com.hbm.blocks.bomb;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNT;
import com.hbm.explosion.ExplosionNT.ExAttrib;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.world.World;
public class BlockChargeDynamite extends BlockChargeBase {
@Override
public BombReturnCode explode(World world, int x, int y, int z) {
return null;
if(!world.isRemote) {
world.setBlockToAir(x, y, z);
ExplosionNT exp = new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 6F);
exp.explode();
ExplosionLarge.spawnParticles(world, x + 0.5, y + 0.5, z + 0.5, 25);
return BombReturnCode.DETONATED;
}
return BombReturnCode.UNDEFINED;
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
@Override
public int getRenderType() {
return renderID;
}
}

View File

@ -5,18 +5,15 @@ import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.RedBarrel;
import com.hbm.config.BombConfig;
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
import com.hbm.entity.effect.EntityEMPBlast;
import com.hbm.entity.logic.EntityNukeExplosionMK3;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.entity.particle.EntityTSmokeFX;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.lib.ModDamageSource;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
@ -38,6 +35,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
@ -133,6 +131,23 @@ public class EntityBulletBase extends Entity implements IProjectile {
this.dataWatcher.updateObject(16, (byte)this.config.style);
this.dataWatcher.updateObject(17, (byte)this.config.trail);
}
public boolean attackEntityFrom(DamageSource source, float amount) {
this.setBeenAttacked();
if(source instanceof EntityDamageSource) {
EntityDamageSource dmg = (EntityDamageSource) source;
if(dmg.damageType.equals("player")) {
this.motionX *= -1.5;
this.motionY *= -1.5;
this.motionZ *= -1.5;
return true;
}
}
return false;
}
@Override
public void setThrowableHeading(double moX, double moY, double moZ, float mult1, float mult2) {

View File

@ -11,14 +11,14 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineShredder extends Container {
private TileEntityMachineShredder diFurnace;
private int progress;
public ContainerMachineShredder(InventoryPlayer invPlayer, TileEntityMachineShredder tedf) {
diFurnace = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 44, 18));
this.addSlotToContainer(new Slot(tedf, 1, 62, 18));
this.addSlotToContainer(new Slot(tedf, 2, 80, 18));
@ -49,90 +49,76 @@ public class ContainerMachineShredder extends Container {
this.addSlotToContainer(new Slot(tedf, 27, 44, 108));
this.addSlotToContainer(new Slot(tedf, 28, 80, 108));
this.addSlotToContainer(new Slot(tedf, 29, 8, 108));
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 9; j++)
{
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56));
}
}
for(int i = 0; i < 9; i++)
{
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 1, this.diFurnace.progress);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
{
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack())
{
if(var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 29) {
if (!this.mergeItemStack(var5, 30, this.inventorySlots.size(), true))
{
if(par2 <= 29) {
if(!this.mergeItemStack(var5, 30, this.inventorySlots.size(), true)) {
return null;
}
}
else
{
if (!this.mergeItemStack(var5, 0, 9, false))
if (!this.mergeItemStack(var5, 27, 30, false))
} else {
if(!this.mergeItemStack(var5, 0, 9, false))
if(!this.mergeItemStack(var5, 27, 30, false))
return null;
}
if (var5.stackSize == 0)
{
if(var5.stackSize == 0) {
var4.putStack((ItemStack) null);
}
else
{
} else {
var4.onSlotChanged();
}
}
return var3;
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return diFurnace.isUseableByPlayer(player);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for(int i = 0; i < this.crafters.size(); i++)
{
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.progress != this.diFurnace.progress)
{
for(int i = 0; i < this.crafters.size(); i++) {
ICrafting par1 = (ICrafting) this.crafters.get(i);
if(this.progress != this.diFurnace.progress) {
par1.sendProgressBarUpdate(this, 1, this.diFurnace.progress);
}
}
this.progress = this.diFurnace.progress;
}
@Override
public void updateProgressBar(int i, int j) {
if(i == 1)
{
if(i == 1) {
diFurnace.progress = j;
}
}

View File

@ -19,7 +19,7 @@ public class ContainerReactorZirnox extends Container {
public ContainerReactorZirnox(InventoryPlayer invPlayer, TileEntityReactorZirnox te) {
zirnox = te;
//Rods
// Rods
this.addSlotToContainer(new Slot(te, 0, 26, 16));
this.addSlotToContainer(new Slot(te, 1, 62, 16));
this.addSlotToContainer(new Slot(te, 2, 98, 16));
@ -45,38 +45,35 @@ public class ContainerReactorZirnox extends Container {
this.addSlotToContainer(new Slot(te, 22, 62, 124));
this.addSlotToContainer(new Slot(te, 23, 98, 124));
//Fluid IO
// Fluid IO
this.addSlotToContainer(new Slot(te, 24, 143, 124));
this.addSlotToContainer(new SlotMachineOutput(te, 26, 143, 142));
this.addSlotToContainer(new Slot(te, 25, 179, 124));
this.addSlotToContainer(new SlotMachineOutput(te, 27, 179, 142));
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 9; j++)
{
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 90));
}
}
for(int i = 0; i < 9; i++)
{
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 232));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack var3 = null;
Slot slot = (Slot) this.inventorySlots.get(index);
if (slot != null && slot.getHasStack()) {
if(slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
var3 = stack.copy();
if (index <= 27) {
if (!this.mergeItemStack(stack, 28, this.inventorySlots.size(), true)) {
if(index <= 27) {
if(!this.mergeItemStack(stack, 28, this.inventorySlots.size(), true)) {
return null;
}
} else {
@ -89,7 +86,7 @@ public class ContainerReactorZirnox extends Container {
if(!this.mergeItemStack(stack, 25, 26, true))
return null;
} else {
} else {
if(stack.getItem() instanceof ItemZirnoxRod) {
@ -99,7 +96,7 @@ public class ContainerReactorZirnox extends Container {
}
}
if (stack.stackSize == 0) {
if(stack.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
@ -107,7 +104,7 @@ public class ContainerReactorZirnox extends Container {
}
return var3;
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {

View File

@ -3324,17 +3324,17 @@ public class ModItems {
radaway = new ItemSimpleConsumable().setUseActionServer((stack, user) -> {
ItemSimpleConsumable.giveSoundAndDecrement(stack, user, "hbm:item.radaway", new ItemStack(ModItems.iv_empty));
user.addPotionEffect(new PotionEffect(HbmPotion.radaway.id, 14, 9));
ItemSimpleConsumable.addPotionEffect(user, HbmPotion.radaway, 140, 0);
}).setUnlocalizedName("radaway").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":radaway");
radaway_strong = new ItemSimpleConsumable().setUseActionServer((stack, user) -> {
ItemSimpleConsumable.giveSoundAndDecrement(stack, user, "hbm:item.radaway", new ItemStack(ModItems.iv_empty));
ItemSimpleConsumable.addPotionEffect(user, HbmPotion.radaway, 14, 9);
ItemSimpleConsumable.addPotionEffect(user, HbmPotion.radaway, 350, 0);
}).setUnlocalizedName("radaway_strong").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":radaway_strong");
radaway_flush = new ItemSimpleConsumable().setUseActionServer((stack, user) -> {
ItemSimpleConsumable.giveSoundAndDecrement(stack, user, "hbm:item.radaway", new ItemStack(ModItems.iv_empty));
ItemSimpleConsumable.addPotionEffect(user, HbmPotion.radaway, 50, 19);
ItemSimpleConsumable.addPotionEffect(user, HbmPotion.radaway, 500, 2);
}).setUnlocalizedName("radaway_flush").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":radaway_flush");
med_bag = new ItemSyringe().setUnlocalizedName("med_bag").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":med_bag");
@ -4487,7 +4487,7 @@ public class ModItems {
cheese = new ItemLemon(5, 10, false).setUnlocalizedName("cheese").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":cheese");
mucho_mango = new ItemMuchoMango(10).setUnlocalizedName("mucho_mango").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":mucho_mango");
defuser = new Item().setUnlocalizedName("defuser").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.nukeTab).setTextureName(RefStrings.MODID + ":defuser");
defuser = new ItemTooling(ToolType.DEFUSER, 100).setUnlocalizedName("defuser").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.nukeTab).setTextureName(RefStrings.MODID + ":defuser");
reacher = new Item().setUnlocalizedName("reacher").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":reacher");
bismuth_tool = new ItemAmatExtractor().setUnlocalizedName("bismuth_tool").setMaxStackSize(1).setFull3D().setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":bismuth_tool");
meltdown_tool = new ItemDyatlov().setUnlocalizedName("meltdown_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":meltdown_tool");

View File

@ -14,7 +14,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;

View File

@ -6,49 +6,68 @@ import org.apache.logging.log4j.Level;
import com.hbm.config.GeneralConfig;
import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.IBomb.BombReturnCode;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.util.ChatBuilder;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class ItemLaserDetonator extends Item {
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool)
{
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add("Aim & click to detonate!");
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
MovingObjectPosition pos = Library.rayTrace(player, 500, 1);
int x = pos.blockX;
int y = pos.blockY;
int z = pos.blockZ;
if(!world.isRemote)
{
if(world.getBlock(x, y, z) instanceof IBomb) {
((IBomb)world.getBlock(x, y, z)).explode(world, x, y, z);
if(GeneralConfig.enableExtendedLogging)
MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
player.addChatMessage(new ChatComponentText("Detonated!"));
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
} else {
player.addChatMessage(new ChatComponentText("Target can not be detonated."));
world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F);
}
if(!world.isRemote) {
if(world.getBlock(x, y, z) instanceof IBomb) {
BombReturnCode ret = ((IBomb) world.getBlock(x, y, z)).explode(world, x, y, z);
if(GeneralConfig.enableExtendedLogging)
MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
.next("] ").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(ret.getUnlocalizedMessage()).color(ret.wasSuccessful() ? EnumChatFormatting.YELLOW : EnumChatFormatting.RED).flush());
} else {
world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F);
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
.next("] ").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(BombReturnCode.ERROR_NO_BOMB.getUnlocalizedMessage()).color(EnumChatFormatting.RED).flush());
}
} else {
Vec3 vec = Vec3.createVectorHelper(x + 0.5 - player.posX, y + 0.5 - player.posY, z + 0.5 - player.posZ);
double len = Math.min(vec.lengthVector(), 15D);
vec = vec.normalize();
for(int i = 0; i < len; i++) {
double rand = world.rand.nextDouble() * len + 3;
world.spawnParticle("reddust", player.posX + vec.xCoord * rand, player.posY + vec.yCoord * rand, player.posZ + vec.zCoord * rand, 0, 0, 0);
}
}
return stack;
}
return stack;
}
}

View File

@ -7,135 +7,147 @@ import org.apache.logging.log4j.Level;
import com.hbm.config.GeneralConfig;
import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.IBomb.BombReturnCode;
import com.hbm.main.MainRegistry;
import com.hbm.util.ChatBuilder;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class ItemMultiDetonator extends Item {
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool)
{
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add("Shift right-click block to add position,");
list.add("right-click to detonate!");
list.add("Shift right-click in the air to clear postitions.");
if(itemstack.getTagCompound() == null || getLocations(itemstack) == null)
{
list.add("No position set!");
if(itemstack.getTagCompound() == null || getLocations(itemstack) == null) {
list.add(EnumChatFormatting.RED + "No position set!");
} else {
int[][] locs = getLocations(itemstack);
for(int i = 0; i < locs[0].length; i++) {
list.add(locs[0][i] + " / " + locs[1][i] + " / " + locs[2][i]);
list.add(EnumChatFormatting.YELLOW + "" + locs[0][i] + " / " + locs[1][i] + " / " + locs[2][i]);
}
}
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
if(stack.stackTagCompound == null)
{
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
if(stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
}
if(player.isSneaking())
{
if(player.isSneaking()) {
addLocation(stack, x, y, z);
if(world.isRemote)
{
player.addChatMessage(new ChatComponentText("Position added!"));
if(!world.isRemote) {
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
.next("] ").color(EnumChatFormatting.DARK_AQUA)
.next("Position added!").color(EnumChatFormatting.GREEN).flush());
}
world.playSoundAtEntity(player, "hbm:item.techBoop", 2.0F, 1.0F);
world.playSoundAtEntity(player, "hbm:item.techBoop", 2.0F, 1.0F);
return true;
}
return false;
}
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if(stack.stackTagCompound == null || getLocations(stack) == null)
{
if(world.isRemote)
player.addChatMessage(new ChatComponentText("Error: Position not set."));
if(stack.stackTagCompound == null || getLocations(stack) == null) {
if(!world.isRemote) {
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
.next("] ").color(EnumChatFormatting.DARK_AQUA)
.next("No position set!").color(EnumChatFormatting.RED).flush());
}
} else {
if(!player.isSneaking()) {
int[][] locs = getLocations(stack);
int succ = 0;
for (int i = 0; i < locs[0].length; i++) {
for(int i = 0; i < locs[0].length; i++) {
int x = locs[0][i];
int y = locs[1][i];
int z = locs[2][i];
if (world.getBlock(x, y, z) instanceof IBomb) {
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
if (!world.isRemote) {
((IBomb) world.getBlock(x, y, z)).explode(world, x, y, z);
if(GeneralConfig.enableExtendedLogging)
MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
}
if(world.getBlock(x, y, z) instanceof IBomb) {
succ++;
if(!world.isRemote) {
BombReturnCode ret = ((IBomb) world.getBlock(x, y, z)).explode(world, x, y, z);
if(ret.wasSuccessful())
succ++;
if(GeneralConfig.enableExtendedLogging)
MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
}
}
}
if (world.isRemote) {
player.addChatMessage(new ChatComponentText("Detonated! (" + succ + "/" + locs[0].length + ")"));
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
if(!world.isRemote) {
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
.next("] ").color(EnumChatFormatting.DARK_AQUA)
.next("Triggered " + succ + "/" + locs[0].length + "!").color(EnumChatFormatting.YELLOW).flush());
}
} else {
stack.stackTagCompound.setIntArray("xValues", new int[0]);
stack.stackTagCompound.setIntArray("yValues", new int[0]);
stack.stackTagCompound.setIntArray("zValues", new int[0]);
world.playSoundAtEntity(player, "hbm:item.techBoop", 2.0F, 1.0F);
world.playSoundAtEntity(player, "hbm:item.techBoop", 2.0F, 1.0F);
if(world.isRemote)
{
player.addChatMessage(new ChatComponentText("All positions removed."));
if(!world.isRemote) {
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
.next("] ").color(EnumChatFormatting.DARK_AQUA)
.next("Locations cleared!").color(EnumChatFormatting.RED).flush());
}
}
}
return stack;
}
private static void addLocation(ItemStack stack, int x, int y, int z) {
if(stack.stackTagCompound == null)
{
if(stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
}
int[] xs = stack.stackTagCompound.getIntArray("xValues");
int[] ys = stack.stackTagCompound.getIntArray("yValues");
int[] zs = stack.stackTagCompound.getIntArray("zValues");
stack.stackTagCompound.setIntArray("xValues", ArrayUtils.add(xs, x));
stack.stackTagCompound.setIntArray("yValues", ArrayUtils.add(ys, y));
stack.stackTagCompound.setIntArray("zValues", ArrayUtils.add(zs, z));
}
private static int[][] getLocations(ItemStack stack) {
int[] xs = stack.stackTagCompound.getIntArray("xValues");
@ -145,7 +157,7 @@ public class ItemMultiDetonator extends Item {
if(xs == null || ys == null || zs == null || xs.length == 0 || ys.length == 0 || zs.length == 0) {
return null;
}
return new int[][] { xs, ys, zs };
}
}

View File

@ -16,6 +16,7 @@ import com.hbm.interfaces.IFluidDuct;
import com.hbm.interfaces.IFluidSource;
import com.hbm.interfaces.Spaghetti;
import com.hbm.items.ModItems;
import com.hbm.tileentity.TileEntityProxyBase;
import com.hbm.tileentity.TileEntityProxyInventory;
import com.hbm.tileentity.conductor.TileEntityFluidDuct;
import com.hbm.tileentity.conductor.TileEntityGasDuct;
@ -531,6 +532,13 @@ public class Library {
if(tileentity == that)
tileentity = null;
if(tileentity instanceof TileEntityProxyBase) {
TileEntityProxyBase proxy = (TileEntityProxyBase) tileentity;
if(proxy.getTE() == that)
tileentity = null;
}
if(tileentity instanceof IFluidDuct)
{
if(tileentity instanceof TileEntityFluidDuct && ((TileEntityFluidDuct)tileentity).type.name().equals(type.name()))

View File

@ -54,7 +54,6 @@ import com.hbm.entity.projectile.*;
import com.hbm.handler.HbmKeybinds;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemSwordMeteorite;
import com.hbm.particle.*;
import com.hbm.render.anim.*;
import com.hbm.render.anim.HbmAnimations.Animation;
@ -291,9 +290,9 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.cmb_sword, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp, sfp, rir, tir, sir));
MinecraftForgeClient.registerItemRenderer(ModItems.dnt_sword, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp, sfp, rir, tir, sir));
for(ItemSwordMeteorite sword : ItemSwordMeteorite.swords) {
// MinecraftForgeClient.registerItemRenderer(sword, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp, sfp, rir, tir, sir));
}
/*for(ItemSwordMeteorite sword : ItemSwordMeteorite.swords) {
MinecraftForgeClient.registerItemRenderer(sword, new ItemRenderTransformer(rtp, ttp_high, stp, rfp, tfp, sfp, rir, tir, sir));
}*/
//test crap
@ -628,6 +627,8 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerBlockHandler(new RenderTestCable());
RenderingRegistry.registerBlockHandler(new RenderBlockCT());
RenderingRegistry.registerBlockHandler(new RenderBlockRotated(ModBlocks.charge_dynamite.getRenderType(), ResourceManager.charge_dynamite));
RenderingRegistry.registerBlockHandler(new RenderRBMKRod());
RenderingRegistry.registerBlockHandler(new RenderRBMKReflector());
RenderingRegistry.registerBlockHandler(new RenderRBMKControl());

View File

@ -2,8 +2,6 @@ package com.hbm.main;
import com.hbm.lib.RefStrings;
import com.hbm.render.loader.HFRWavefrontObject;
import com.hbm.render.shader.Shader;
import com.hbm.render.shader.ShaderManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
@ -1131,6 +1129,8 @@ public class ResourceManager {
public static final IModelCustom crystal_robust = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/crystals_robust.obj"));
public static final IModelCustom crystal_trixite = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/crystals_trixite.obj"));
public static final IModelCustom cable_neo = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/cable_neo.obj"));
public static final IModelCustom charge_dynamite = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/charge_dynamite.obj"));
//RBMK DEBRIS
public static final IModelCustom deb_blank = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/projectiles/deb_blank.obj"));

View File

@ -0,0 +1,96 @@
package com.hbm.render.block;
import org.lwjgl.opengl.GL11;
import com.hbm.render.util.ObjUtil;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.IModelCustom;
import net.minecraftforge.client.model.obj.WavefrontObject;
public class RenderBlockRotated implements ISimpleBlockRenderingHandler {
private int renderID;
private IModelCustom model;
public RenderBlockRotated(int renderType, IModelCustom IModelCustom) {
this.renderID = renderType;
this.model = IModelCustom;
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
IIcon iicon = block.getIcon(0, 0);
tessellator.setColorOpaque_F(1, 1, 1);
if(renderer.hasOverrideBlockTexture()) {
iicon = renderer.overrideBlockTexture;
}
GL11.glRotated(180, 0, 1, 0);
tessellator.startDrawingQuads();
ObjUtil.renderWithIcon((WavefrontObject) model, iicon, tessellator, 0, false);
tessellator.draw();
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
Tessellator tessellator = Tessellator.instance;
IIcon iicon = block.getIcon(0, 0);
tessellator.setColorOpaque_F(1, 1, 1);
if(renderer.hasOverrideBlockTexture()) {
iicon = renderer.overrideBlockTexture;
}
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
float flip = 0;
float rotation = 0;
int meta = world.getBlockMetadata(x, y, z);
if(meta == 0)
flip = (float)Math.PI;
if(meta == 2)
rotation = 90F / 180F * (float) Math.PI;
if(meta == 3)
rotation = 270F / 180F * (float) Math.PI;
if(meta == 4)
rotation = 180F / 180F * (float)Math.PI;
if(rotation != 0F || meta == 5)
flip = (float)Math.PI * 0.5F;
tessellator.addTranslation(x + 0.5F, y + 0.5F, z + 0.5F);
ObjUtil.renderWithIcon((WavefrontObject) model, iicon, tessellator, rotation, flip, true);
tessellator.addTranslation(-x - 0.5F, -y - 0.5F, -z - 0.5F);
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return this.renderID;
}
}

View File

@ -77,7 +77,7 @@ public class RenderCrystal implements ISimpleBlockRenderingHandler {
if(meta == 4)
rotation = 180F / 180F * (float)Math.PI;
if(rotation != 0F)
if(rotation != 0F || meta == 5)
flip = (float)Math.PI * 0.5F;
tessellator.addTranslation(x + 0.5F, y + 0.5F, z + 0.5F);

View File

@ -9,45 +9,43 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityProxyBase extends TileEntity {
public boolean canUpdate()
{
return false;
}
public boolean canUpdate() {
return false;
}
public TileEntity getTE() {
if(this.getBlockType() instanceof BlockDummyable) {
BlockDummyable dummy = (BlockDummyable)this.getBlockType();
BlockDummyable dummy = (BlockDummyable) this.getBlockType();
int[] pos = dummy.findCore(worldObj, xCoord, yCoord, zCoord);
if(pos != null) {
TileEntity te = worldObj.getTileEntity(pos[0], pos[1], pos[2]);
if(te != null)
return te;
}
}
/// this spares me the hassle of registering a new child class TE that aims at the right target ///
/// this spares me the hassle of registering a new child class TE that
/// aims at the right target ///
if(this.getBlockType() instanceof BlockHadronAccess) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
for(int i = 1; i < 3; i++) {
TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX * i, yCoord + dir.offsetY * i, zCoord + dir.offsetZ * i);
if(te instanceof TileEntityHadron) {
return te;
}
}
}
return null;
}
}

View File

@ -0,0 +1,181 @@
# Blender v2.79 (sub 0) OBJ File: 'charge_dynamite.blend'
# www.blender.org
o Plane
v -0.125000 -0.500000 0.437500
v 0.125000 -0.500000 0.437500
v -0.125000 -0.500000 -0.437500
v 0.125000 -0.500000 -0.437500
v -0.125000 -0.250000 0.437500
v 0.125000 -0.250000 0.437500
v -0.125000 -0.250000 -0.437500
v 0.125000 -0.250000 -0.437500
v 0.187500 -0.500000 0.437500
v 0.437500 -0.500000 0.437500
v 0.187500 -0.500000 -0.437500
v 0.437500 -0.500000 -0.437500
v 0.187500 -0.250000 0.437500
v 0.437500 -0.250000 0.437500
v 0.187500 -0.250000 -0.437500
v 0.437500 -0.250000 -0.437500
v -0.437500 -0.500000 0.437500
v -0.187500 -0.500000 0.437500
v -0.437500 -0.500000 -0.437500
v -0.187500 -0.500000 -0.437500
v -0.437500 -0.250000 0.437500
v -0.187500 -0.250000 0.437500
v -0.437500 -0.250000 -0.437500
v -0.187500 -0.250000 -0.437500
v -0.250000 -0.312500 0.250000
v 0.250000 -0.312500 0.250000
v -0.250000 -0.312500 -0.250000
v 0.250000 -0.312500 -0.250000
v -0.250000 -0.187500 -0.250000
v -0.250000 -0.187500 0.250000
v 0.250000 -0.187500 0.250000
v 0.250000 -0.187500 -0.250000
vt 0.875000 0.000000
vt -0.000000 0.250000
vt -0.000000 0.000000
vt -0.000000 0.000000
vt 0.875000 0.250000
vt -0.000000 0.250000
vt 0.875000 -0.000000
vt -0.000000 0.250000
vt -0.000000 -0.000000
vt -0.000000 0.250000
vt 0.875000 0.000000
vt 0.875000 0.250000
vt 0.250000 0.250000
vt 0.000000 0.500000
vt 0.000000 0.250000
vt 0.250000 0.250000
vt -0.000000 0.500000
vt 0.875000 0.000000
vt -0.000000 0.250000
vt -0.000000 0.000000
vt -0.000000 0.000000
vt 0.875000 0.250000
vt -0.000000 0.250000
vt 0.875000 -0.000000
vt -0.000000 0.250000
vt -0.000000 -0.000000
vt -0.000000 0.250000
vt 0.875000 0.000000
vt 0.875000 0.250000
vt 0.250000 0.250000
vt 0.000000 0.500000
vt 0.000000 0.250000
vt 0.250000 0.250000
vt -0.000000 0.500000
vt 0.875000 0.000000
vt -0.000000 0.250000
vt -0.000000 0.000000
vt -0.000000 0.000000
vt 0.875000 0.250000
vt -0.000000 0.250000
vt 0.875000 -0.000000
vt -0.000000 0.250000
vt -0.000000 -0.000000
vt -0.000000 0.250000
vt 0.875000 0.000000
vt 0.875000 0.250000
vt 0.250000 0.250000
vt 0.000000 0.500000
vt 0.000000 0.250000
vt 0.250000 0.250000
vt -0.000000 0.500000
vt 0.250000 0.875000
vt 0.750000 0.375000
vt 0.750000 0.875000
vt 0.250000 0.375000
vt 0.750000 0.875000
vt 0.250000 0.875000
vt 0.750000 0.250000
vt 0.250000 0.375000
vt 0.250000 0.250000
vt 0.750000 0.250000
vt 0.250000 0.375000
vt 0.250000 0.250000
vt 0.750000 0.250000
vt 0.250000 0.250000
vt 0.750000 0.250000
vt 0.250000 0.375000
vt 0.250000 0.250000
vt 0.875000 0.250000
vt 0.875000 0.000000
vt 0.875000 0.250000
vt -0.000000 0.000000
vt 0.250000 0.500000
vt 0.250000 0.500000
vt 0.875000 0.250000
vt 0.875000 0.000000
vt 0.875000 0.250000
vt -0.000000 0.000000
vt 0.250000 0.500000
vt 0.250000 0.500000
vt 0.875000 0.250000
vt 0.875000 0.000000
vt 0.875000 0.250000
vt -0.000000 0.000000
vt 0.250000 0.500000
vt 0.250000 0.500000
vt 0.250000 0.375000
vt 0.750000 0.375000
vt 0.750000 0.375000
vt 0.750000 0.375000
vt 0.750000 0.375000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 0.0000 0.0000 1.0000
s off
f 3/1/1 2/2/1 1/3/1
f 6/4/2 7/5/2 5/6/2
f 4/7/3 6/8/3 2/9/3
f 1/10/4 7/11/4 3/12/4
f 3/13/5 8/14/5 4/15/5
f 2/16/6 5/17/6 1/10/6
f 11/18/1 10/19/1 9/20/1
f 14/21/2 15/22/2 13/23/2
f 12/24/3 14/25/3 10/26/3
f 9/27/4 15/28/4 11/29/4
f 11/30/5 16/31/5 12/32/5
f 10/33/6 13/34/6 9/27/6
f 19/35/1 18/36/1 17/37/1
f 22/38/2 23/39/2 21/40/2
f 20/41/3 22/42/3 18/43/3
f 17/44/4 23/45/4 19/46/4
f 19/47/5 24/48/5 20/49/5
f 18/50/6 21/51/6 17/44/6
f 27/52/1 26/53/1 25/54/1
f 31/55/2 29/56/2 30/57/2
f 27/58/5 32/59/5 28/60/5
f 26/61/6 30/62/6 25/63/6
f 28/64/3 31/55/3 26/65/3
f 25/66/4 29/67/4 27/68/4
f 3/1/1 4/69/1 2/2/1
f 6/4/2 8/70/2 7/5/2
f 4/7/3 8/71/3 6/8/3
f 1/10/4 5/72/4 7/11/4
f 3/13/5 7/73/5 8/14/5
f 2/16/6 6/74/6 5/17/6
f 11/18/1 12/75/1 10/19/1
f 14/21/2 16/76/2 15/22/2
f 12/24/3 16/77/3 14/25/3
f 9/27/4 13/78/4 15/28/4
f 11/30/5 15/79/5 16/31/5
f 10/33/6 14/80/6 13/34/6
f 19/35/1 20/81/1 18/36/1
f 22/38/2 24/82/2 23/39/2
f 20/41/3 24/83/3 22/42/3
f 17/44/4 21/84/4 23/45/4
f 19/47/5 23/85/5 24/48/5
f 18/50/6 22/86/6 21/51/6
f 27/52/1 28/87/1 26/53/1
f 31/55/2 32/88/2 29/56/2
f 27/58/5 29/89/5 32/59/5
f 26/61/6 31/90/6 30/62/6
f 28/64/3 32/88/3 31/55/3
f 25/66/4 30/91/4 29/67/4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB