mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
better BlockDummyable collisions, some more sawmill stuff
This commit is contained in:
parent
77c0ae1834
commit
afb6ba1476
@ -13,6 +13,7 @@ import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -22,6 +23,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -412,4 +414,52 @@ public abstract class BlockDummyable extends BlockContainer {
|
||||
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
|
||||
player.addExhaustion(0.025F);
|
||||
}
|
||||
|
||||
public boolean useDetailedHitbox() {
|
||||
return !bounding.isEmpty();
|
||||
}
|
||||
|
||||
public List<AxisAlignedBB> bounding = new ArrayList();
|
||||
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||
|
||||
if(!this.useDetailedHitbox()) {
|
||||
super.addCollisionBoxesToList(world, x, y, z, entityBounding, list, entity);
|
||||
return;
|
||||
}
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null)
|
||||
return;
|
||||
|
||||
x = pos[0];
|
||||
y = pos[1];
|
||||
z = pos[2];
|
||||
|
||||
for(AxisAlignedBB aabb :this.bounding) {
|
||||
AxisAlignedBB boxlet = getAABBRotationOffset(aabb, x, y, z, ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) - this.offset).getRotation(ForgeDirection.UP));
|
||||
|
||||
if(entityBounding.intersectsWith(boxlet)) {
|
||||
list.add(boxlet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static AxisAlignedBB getAABBRotationOffset(AxisAlignedBB aabb, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
AxisAlignedBB newBox = null;
|
||||
|
||||
if(dir == ForgeDirection.NORTH) newBox = AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
|
||||
if(dir == ForgeDirection.EAST) newBox = AxisAlignedBB.getBoundingBox(-aabb.maxZ, aabb.minY, aabb.minX, -aabb.minZ, aabb.maxY, aabb.maxX);
|
||||
if(dir == ForgeDirection.SOUTH) newBox = AxisAlignedBB.getBoundingBox(-aabb.maxX, aabb.minY, -aabb.maxZ, -aabb.minX, aabb.maxY, -aabb.minZ);
|
||||
if(dir == ForgeDirection.WEST) newBox = AxisAlignedBB.getBoundingBox(aabb.minZ, aabb.minY, -aabb.maxX, aabb.maxZ, aabb.maxY, -aabb.minX);
|
||||
|
||||
if(newBox != null) {
|
||||
newBox.offset(x + 0.5, y, z + 0.5);
|
||||
return newBox;
|
||||
}
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ).offset(x + 0.5, y + 0.5, z + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,12 +6,19 @@ import com.hbm.tileentity.machine.TileEntityCrucible;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineCrucible extends BlockDummyable {
|
||||
|
||||
public MachineCrucible() {
|
||||
super(Material.rock);
|
||||
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-1.5D, 0D, -1.5D, 1.5D, 0.5D, 1.5D));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-1.25D, 0.5D, -1.25D, 1.25D, 1.5D, -1D));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-1.25D, 0.5D, -1.25D, -1D, 1.5D, 1.25D));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-1.25D, 0.5D, 1D, 1.25D, 1.5D, 1.25D));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(1D, 0.5D, -1.25D, 1.25D, 1.5D, 1.25D));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -13,10 +13,14 @@ import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -25,6 +29,10 @@ public class MachineSawmill extends BlockDummyable implements ILookOverlay, IToo
|
||||
|
||||
public MachineSawmill() {
|
||||
super(Material.iron);
|
||||
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-1.5D, 0D, -1.5D, 1.5D, 1D, 1.5D));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-1.25D, 1D, -0.5D, -0.625D, 1.875D, 0.5D));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-0.625D, 1D, -1D, 1.375D, 2D, 1D));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,6 +120,56 @@ public class MachineSawmill extends BlockDummyable implements ILookOverlay, IToo
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, player, itemStack);
|
||||
|
||||
if(itemStack.getItemDamage() == 1) {
|
||||
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
int o = -getOffset();
|
||||
|
||||
ForgeDirection dir = ForgeDirection.NORTH;
|
||||
if(i == 0) dir = ForgeDirection.getOrientation(2);
|
||||
if(i == 1) dir = ForgeDirection.getOrientation(5);
|
||||
if(i == 2) dir = ForgeDirection.getOrientation(3);
|
||||
if(i == 3) dir = ForgeDirection.getOrientation(4);
|
||||
|
||||
dir = getDirModified(dir);
|
||||
|
||||
TileEntity te = world.getTileEntity(x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o);
|
||||
|
||||
if(te instanceof TileEntitySawmill) {
|
||||
((TileEntitySawmill) te).hasBlade = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
|
||||
int count = quantityDropped(metadata, fortune, world.rand);
|
||||
int dmg = 0;
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos != null) {
|
||||
TileEntitySawmill stirling = (TileEntitySawmill)world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(!stirling.hasBlade) {
|
||||
dmg = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
Item item = getItemDropped(metadata, world.rand, fortune);
|
||||
if(item != null) {
|
||||
ret.add(new ItemStack(item, 1, dmg));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { }
|
||||
|
||||
|
||||
@ -20,8 +20,8 @@ public class MachineTeleanchor extends BlockBase {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":teleanchor_top");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":teleanchor_side");
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":tele_anchor_top");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":tele_anchor_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -22,34 +22,21 @@ public class FuelHandler implements IFuelHandler {
|
||||
if(fuel.getItem().equals(ModItems.solid_fuel_presto_triplet_bf)) return single * 2000;
|
||||
if(fuel.getItem().equals(ModItems.rocket_fuel)) return single * 32;
|
||||
|
||||
if(fuel.getItem().equals(ModItems.biomass))
|
||||
return 800;
|
||||
if(fuel.getItem().equals(ModItems.biomass_compressed))
|
||||
return 2400;
|
||||
if(fuel.getItem().equals(ModItems.powder_coal))
|
||||
return 1600;
|
||||
if(fuel.getItem().equals(ModItems.scrap))
|
||||
return 800;
|
||||
if(fuel.getItem().equals(ModItems.dust))
|
||||
return 400;
|
||||
if(fuel.getItem().equals(ModItems.powder_fire))
|
||||
return 6400;
|
||||
if(fuel.getItem().equals(Item.getItemFromBlock(ModBlocks.block_scrap)))
|
||||
return 4000;
|
||||
if(fuel.getItem() == ModItems.lignite)
|
||||
return 1200;
|
||||
if(fuel.getItem() == ModItems.powder_lignite)
|
||||
return 1200;
|
||||
if(fuel.getItem() == ModItems.briquette_lignite)
|
||||
return 1600;
|
||||
if(fuel.getItem() == ModItems.coke)
|
||||
return 3200;
|
||||
if(fuel.getItem() == ModItems.book_guide)
|
||||
return 800;
|
||||
if(fuel.getItem() == ModItems.coal_infernal)
|
||||
return 4800;
|
||||
if(fuel.getItem() == ModItems.crystal_coal)
|
||||
return 6400;
|
||||
if(fuel.getItem().equals(ModItems.biomass)) return 800;
|
||||
if(fuel.getItem().equals(ModItems.biomass_compressed)) return 2400;
|
||||
if(fuel.getItem().equals(ModItems.powder_coal)) return 1600;
|
||||
if(fuel.getItem().equals(ModItems.scrap)) return 800;
|
||||
if(fuel.getItem().equals(ModItems.dust)) return 400;
|
||||
if(fuel.getItem().equals(ModItems.powder_fire)) return 6400;
|
||||
if(fuel.getItem().equals(Item.getItemFromBlock(ModBlocks.block_scrap))) return 4000;
|
||||
if(fuel.getItem() == ModItems.lignite) return 1200;
|
||||
if(fuel.getItem() == ModItems.powder_lignite) return 1200;
|
||||
if(fuel.getItem() == ModItems.briquette_lignite) return 1600;
|
||||
if(fuel.getItem() == ModItems.coke) return 3200;
|
||||
if(fuel.getItem() == ModItems.book_guide) return 800;
|
||||
if(fuel.getItem() == ModItems.coal_infernal) return 4800;
|
||||
if(fuel.getItem() == ModItems.crystal_coal) return 6400;
|
||||
if(fuel.getItem() == ModItems.powder_sawdust) return 100;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -214,6 +214,15 @@ public class AnvilRecipes {
|
||||
new ComparableStack(ModItems.gear_large, 1, 1)
|
||||
}, new AnvilOutput(new ItemStack(ModBlocks.machine_stirling_steel))).setTier(2));
|
||||
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new AStack[] {
|
||||
new OreDictStack(KEY_PLANKS, 16),
|
||||
new OreDictStack(STEEL.plate(), 6),
|
||||
new OreDictStack(CU.ingot(), 8),
|
||||
new OreDictStack(IRON.ingot(), 4),
|
||||
new ComparableStack(ModItems.sawblade)
|
||||
}, new AnvilOutput(new ItemStack(ModBlocks.machine_sawmill))).setTier(2));
|
||||
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new AStack[] {
|
||||
new OreDictStack(STEEL.ingot(), 6),
|
||||
|
||||
@ -950,6 +950,7 @@ public class CraftingManager {
|
||||
|
||||
addRecipeAuto(new ItemStack(ModItems.gear_large, 1, 0), new Object[] { "III", "ICI", "III", 'I', IRON.plate(), 'C', CU.ingot()});
|
||||
addRecipeAuto(new ItemStack(ModItems.gear_large, 1, 1), new Object[] { "III", "ICI", "III", 'I', STEEL.plate(), 'C', TI.ingot()});
|
||||
addRecipeAuto(new ItemStack(ModItems.sawblade), new Object[] { "III", "ICI", "III", 'I', STEEL.plate(), 'C', IRON.ingot()});
|
||||
|
||||
addShapelessAuto(new ItemStack(ModItems.upgrade_5g), new Object[] { ModItems.upgrade_template, ModItems.gem_alexandrite });
|
||||
|
||||
|
||||
@ -2,7 +2,9 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAutocrafter.InventoryCraftingAuto;
|
||||
@ -11,6 +13,7 @@ import com.hbm.util.ItemStackUtil;
|
||||
import api.hbm.tile.IHeatSource;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
@ -19,6 +22,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntitySawmill extends TileEntityMachineBase {
|
||||
|
||||
@ -76,6 +80,14 @@ public class TileEntitySawmill extends TileEntityMachineBase {
|
||||
} else {
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(-1D, 0.375D, -1D, -0.875, 2.375D, 1D);
|
||||
aabb = BlockDummyable.getAABBRotationOffset(aabb, xCoord, yCoord, zCoord, ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getRotation(ForgeDirection.UP));
|
||||
for(Object o : worldObj.getEntitiesWithinAABB(EntityLivingBase.class, aabb)) {
|
||||
EntityLivingBase living = (EntityLivingBase) o;
|
||||
living.attackEntityFrom(ModDamageSource.turbofan, 100);
|
||||
}
|
||||
|
||||
} else {
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
@ -2654,6 +2654,7 @@ item.sat_miner.name=Asteroiden-Förderschiff
|
||||
item.sat_radar.name=Radar-Überwachungssatellit
|
||||
item.sat_resonator.name=Xenium-Resonator-Satellit
|
||||
item.sat_scanner.name=Satellit mit Tiefenscanning-Modul
|
||||
item.sawblade.name=Sägeblatt
|
||||
item.schnitzel_vegan.name=Veganes Schnitzel
|
||||
item.schrabidium_axe.name=Schrabidiumaxt
|
||||
item.schrabidium_boots.name=Schrabidiumstiefel
|
||||
|
||||
@ -3076,6 +3076,7 @@ item.sat_miner.name=Asteroid Mining Ship
|
||||
item.sat_radar.name=Radar Survey Satellite
|
||||
item.sat_resonator.name=Xenium Resonator Satellite
|
||||
item.sat_scanner.name=Satellite with Depth-Resource Scanning Module
|
||||
item.sawblade.name=Sawblade
|
||||
item.schnitzel_vegan.name=Vegan Schnitzel
|
||||
item.schrabidium_axe.name=Schrabidium Axe
|
||||
item.schrabidium_boots.name=Schrabidium Boots
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user