Merge remote-tracking branch 'origin/1.12' into 1.12
This commit is contained in:
commit
a32c40a68a
15 changed files with 235 additions and 133 deletions
|
@ -47,6 +47,7 @@ import prospector.shootingstar.ShootingStar;
|
|||
import prospector.shootingstar.model.ModelCompound;
|
||||
import reborncore.api.ToolManager;
|
||||
import reborncore.common.BaseTileBlock;
|
||||
import reborncore.common.blocks.BlockWrenchEventHandler;
|
||||
import reborncore.common.items.WrenchHelper;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileAlarm;
|
||||
|
@ -67,6 +68,7 @@ public class BlockAlarm extends BaseTileBlock {
|
|||
this.bbs = GenBoundingBoxes(0.19, 0.81);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/lighting"));
|
||||
BlockWrenchEventHandler.wrenableBlocks.add(this);
|
||||
}
|
||||
|
||||
private static AxisAlignedBB[] GenBoundingBoxes(double depth, double width) {
|
||||
|
|
|
@ -30,9 +30,12 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
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.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -41,8 +44,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import prospector.shootingstar.ShootingStar;
|
||||
import prospector.shootingstar.model.ModelCompound;
|
||||
import reborncore.api.ToolManager;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import reborncore.common.blocks.BlockWrenchEventHandler;
|
||||
import reborncore.common.blocks.PropertyString;
|
||||
import reborncore.common.items.WrenchHelper;
|
||||
import reborncore.common.multiblock.BlockMultiblockBase;
|
||||
import reborncore.common.util.ArrayUtils;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
@ -68,6 +74,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
|
|||
for (int i = 0; i < types.length; i++) {
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure").setInvVariant("type=" + types[i]));
|
||||
}
|
||||
BlockWrenchEventHandler.wrenableBlocks.add(this);
|
||||
}
|
||||
|
||||
public static ItemStack getStackByName(String name, int count) {
|
||||
|
@ -104,13 +111,41 @@ public class BlockMachineCasing extends BlockMultiblockBase {
|
|||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired){
|
||||
if (state.getValue(TYPE) == "reinforced") {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
}
|
||||
else if (state.getValue(TYPE) == "advanced") {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 2));
|
||||
}
|
||||
else {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0));
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand,
|
||||
EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
|
||||
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||
|
||||
// We extended BaseTileBlock. Thus we should always have tile entity. I hope.
|
||||
if (tileEntity == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (WrenchHelper.handleWrench(stack, worldIn, pos, playerIn, side)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta > types.length) {
|
||||
|
|
|
@ -35,7 +35,6 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
|
@ -48,6 +47,9 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import reborncore.api.ToolManager;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import reborncore.common.blocks.BlockWrenchEventHandler;
|
||||
import reborncore.common.items.WrenchHelper;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
@ -89,6 +91,7 @@ public class BlockCable extends BlockContainer {
|
|||
setResistance(8F);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setDefaultState(getDefaultState().withProperty(EAST, false).withProperty(WEST, false).withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(UP, false).withProperty(DOWN, false).withProperty(TYPE, EnumCableType.COPPER));
|
||||
BlockWrenchEventHandler.wrenableBlocks.add(this);
|
||||
}
|
||||
|
||||
public static ItemStack getCableByName(String name, int count) {
|
||||
|
@ -105,27 +108,84 @@ public class BlockCable extends BlockContainer {
|
|||
return getCableByName(name, 1);
|
||||
}
|
||||
|
||||
//see for more info https://www.reddit.com/r/feedthebeast/comments/5mxwq9/psa_mod_devs_do_you_call_worldgettileentity_from/
|
||||
public TileEntity getTileEntitySafely(IBlockAccess blockAccess, BlockPos pos) {
|
||||
if (blockAccess instanceof ChunkCache) {
|
||||
return ((ChunkCache) blockAccess).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);
|
||||
} else {
|
||||
return blockAccess.getTileEntity(pos);
|
||||
}
|
||||
}
|
||||
|
||||
public IProperty<Boolean> getProperty(EnumFacing facing) {
|
||||
switch (facing) {
|
||||
case EAST:
|
||||
return EAST;
|
||||
case WEST:
|
||||
return WEST;
|
||||
case NORTH:
|
||||
return NORTH;
|
||||
case SOUTH:
|
||||
return SOUTH;
|
||||
case UP:
|
||||
return UP;
|
||||
case DOWN:
|
||||
return DOWN;
|
||||
default:
|
||||
return EAST;
|
||||
}
|
||||
}
|
||||
|
||||
// BlockContainer
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileCable();
|
||||
}
|
||||
|
||||
// Block
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack) && playerIn.isSneaking()) {
|
||||
if (ToolManager.INSTANCE.handleTool(stack, pos, world, playerIn, facing, false)) {
|
||||
ItemStack drop = state.getValue(TYPE).getStack();
|
||||
if (drop == null) {
|
||||
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||
|
||||
// We should always have tile entity. I hope.
|
||||
if (tileEntity == null) {
|
||||
return false;
|
||||
}
|
||||
if (!drop.isEmpty()) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
world.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, ModSounds.BLOCK_DISMANTLE,
|
||||
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||
if (!world.isRemote) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
}
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (WrenchHelper.handleWrench(stack, worldIn, pos, playerIn, side)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onBlockActivated(world, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
|
||||
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired){
|
||||
if (state.getValue(TYPE) == EnumCableType.ICOPPER) {
|
||||
drops.add(getCableByName("copper", 1));
|
||||
}
|
||||
else if (state.getValue(TYPE) == EnumCableType.IGOLD) {
|
||||
drops.add(getCableByName("gold", 1));
|
||||
}
|
||||
else if (state.getValue(TYPE) == EnumCableType.IHV) {
|
||||
drops.add(getCableByName("hv", 1));
|
||||
}
|
||||
else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -224,45 +284,6 @@ public class BlockCable extends BlockContainer {
|
|||
return actualState;
|
||||
}
|
||||
|
||||
//see for more info https://www.reddit.com/r/feedthebeast/comments/5mxwq9/psa_mod_devs_do_you_call_worldgettileentity_from/
|
||||
public TileEntity getTileEntitySafely(IBlockAccess blockAccess, BlockPos pos) {
|
||||
if (blockAccess instanceof ChunkCache) {
|
||||
return ((ChunkCache) blockAccess).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);
|
||||
} else {
|
||||
return blockAccess.getTileEntity(pos);
|
||||
}
|
||||
}
|
||||
|
||||
public IProperty<Boolean> getProperty(EnumFacing facing) {
|
||||
switch (facing) {
|
||||
case EAST:
|
||||
return EAST;
|
||||
case WEST:
|
||||
return WEST;
|
||||
case NORTH:
|
||||
return NORTH;
|
||||
case SOUTH:
|
||||
return SOUTH;
|
||||
case UP:
|
||||
return UP;
|
||||
case DOWN:
|
||||
return DOWN;
|
||||
default:
|
||||
return EAST;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileCable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entity) {
|
||||
super.onEntityCollidedWithBlock(worldIn, pos, state, entity);
|
||||
|
|
|
@ -47,8 +47,6 @@ import techreborn.lib.ModInfo;
|
|||
import techreborn.tiles.generator.TileCreativeSolarPanel;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
*/
|
||||
|
@ -83,16 +81,12 @@ public class BlockCreativeSolarPanel extends BaseTileBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
NonNullList<ItemStack> items = NonNullList.create();
|
||||
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
items.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
} else {
|
||||
super.getDrops(items, world, pos, state, fortune);
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,6 +31,8 @@ import net.minecraft.block.state.BlockFaceShape;
|
|||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -41,7 +43,10 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import prospector.shootingstar.ShootingStar;
|
||||
import prospector.shootingstar.model.ModelCompound;
|
||||
import reborncore.api.ToolManager;
|
||||
import reborncore.common.BaseTileBlock;
|
||||
import reborncore.common.blocks.BlockWrenchEventHandler;
|
||||
import reborncore.common.items.WrenchHelper;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.lighting.TileLamp;
|
||||
|
@ -50,19 +55,6 @@ public class BlockLamp extends BaseTileBlock {
|
|||
|
||||
public static PropertyDirection FACING;
|
||||
public static PropertyBool ACTIVE;
|
||||
|
||||
private static AxisAlignedBB[] GenBoundingBoxes(double depth, double width) {
|
||||
AxisAlignedBB[] bb = {
|
||||
new AxisAlignedBB(width, 1.0 - depth, width, 1.0 - width, 1.0D, 1.0 - width),
|
||||
new AxisAlignedBB(width, 0.0D, width, 1.0 - width, depth, 1.0 - width),
|
||||
new AxisAlignedBB(width, width, 1.0 - depth, 1.0 - width, 1.0 - width, 1.0D),
|
||||
new AxisAlignedBB(width, width, 0.0D, 1.0 - width, 1.0 - width, depth),
|
||||
new AxisAlignedBB(1.0 - depth, width, width, 1.0D, 1.0 - width, 1.0 - width),
|
||||
new AxisAlignedBB(0.0D, width, width, depth, 1.0 - width, 1.0 - width),
|
||||
};
|
||||
return bb;
|
||||
}
|
||||
|
||||
private AxisAlignedBB[] bbs;
|
||||
|
||||
private int cost;
|
||||
|
@ -76,6 +68,19 @@ public class BlockLamp extends BaseTileBlock {
|
|||
this.cost = cost;
|
||||
this.brightness = brightness;
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/lighting"));
|
||||
BlockWrenchEventHandler.wrenableBlocks.add(this);
|
||||
}
|
||||
|
||||
private static AxisAlignedBB[] GenBoundingBoxes(double depth, double width) {
|
||||
AxisAlignedBB[] bb = {
|
||||
new AxisAlignedBB(width, 1.0 - depth, width, 1.0 - width, 1.0D, 1.0 - width),
|
||||
new AxisAlignedBB(width, 0.0D, width, 1.0 - width, depth, 1.0 - width),
|
||||
new AxisAlignedBB(width, width, 1.0 - depth, 1.0 - width, 1.0 - width, 1.0D),
|
||||
new AxisAlignedBB(width, width, 0.0D, 1.0 - width, 1.0 - width, depth),
|
||||
new AxisAlignedBB(1.0 - depth, width, width, 1.0D, 1.0 - width, 1.0 - width),
|
||||
new AxisAlignedBB(0.0D, width, width, depth, 1.0 - width, 1.0 - width),
|
||||
};
|
||||
return bb;
|
||||
}
|
||||
|
||||
public static boolean isActive(IBlockState state) {
|
||||
|
@ -162,6 +167,26 @@ public class BlockLamp extends BaseTileBlock {
|
|||
return this.bbs[getFacing(state).getIndex()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
|
||||
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
|
||||
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||
|
||||
// We extended BaseTileBlock. Thus we should always have tile entity. I hope.
|
||||
if (tileEntity == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
|
||||
if (WrenchHelper.handleWrench(stack, worldIn, pos, playerIn, side)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int facingInt = state.getValue(FACING).getIndex();
|
||||
|
|
|
@ -27,6 +27,7 @@ package techreborn.blocks.storage;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -35,9 +36,6 @@ import techreborn.client.EGui;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.storage.TileAdjustableSU;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockAdjustableSU extends BlockEnergyStorage {
|
||||
|
||||
public BlockAdjustableSU() {
|
||||
|
@ -50,16 +48,11 @@ public class BlockAdjustableSU extends BlockEnergyStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
items.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 2));
|
||||
}
|
||||
else {
|
||||
items.add(new ItemStack(this));
|
||||
}
|
||||
|
||||
return items;
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 2));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ package techreborn.blocks.storage;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -35,9 +36,6 @@ import techreborn.client.EGui;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.storage.TileHighVoltageSU;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
|
@ -53,16 +51,11 @@ public class BlockHighVoltageSU extends BlockEnergyStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
items.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
}
|
||||
else {
|
||||
items.add(new ItemStack(this));
|
||||
}
|
||||
|
||||
return items;
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,9 +29,13 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.idsu.TileInterdimensionalSU;
|
||||
|
||||
public class BlockInterdimensionalSU extends BlockEnergyStorage {
|
||||
|
@ -63,4 +67,13 @@ public class BlockInterdimensionalSU extends BlockEnergyStorage {
|
|||
((TileInterdimensionalSU) tile).ownerUdid = placer.getUniqueID().toString();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,14 +42,13 @@ import prospector.shootingstar.model.ModelCompound;
|
|||
import reborncore.api.ToolManager;
|
||||
import reborncore.common.BaseTileBlock;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import reborncore.common.blocks.BlockWrenchEventHandler;
|
||||
import reborncore.common.items.WrenchHelper;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.lesu.TileLSUStorage;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Energy storage block for LESU
|
||||
*/
|
||||
|
@ -59,6 +58,7 @@ public class BlockLSUStorage extends BaseTileBlock {
|
|||
super(Material.IRON);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/energy"));
|
||||
BlockWrenchEventHandler.wrenableBlocks.add(this);
|
||||
}
|
||||
|
||||
// BaseTileBlock
|
||||
|
@ -111,16 +111,12 @@ public class BlockLSUStorage extends BaseTileBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
NonNullList<ItemStack> items = NonNullList.create();
|
||||
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
items.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0));
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0));
|
||||
} else {
|
||||
super.getDrops(items, world, pos, state, fortune);
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,9 +24,16 @@
|
|||
|
||||
package techreborn.blocks.storage;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.lesu.TileLapotronicSU;
|
||||
|
||||
public class BlockLapotronicSU extends BlockEnergyStorage {
|
||||
|
@ -39,4 +46,13 @@ public class BlockLapotronicSU extends BlockEnergyStorage {
|
|||
public TileEntity createNewTileEntity(final World world, final int meta) {
|
||||
return new TileLapotronicSU();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ package techreborn.blocks.storage;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -35,9 +36,6 @@ import techreborn.client.EGui;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.storage.TileMediumVoltageSU;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
|
@ -53,16 +51,11 @@ public class BlockMediumVoltageSU extends BlockEnergyStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
items.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0));
|
||||
}
|
||||
else {
|
||||
items.add(new ItemStack(this));
|
||||
}
|
||||
|
||||
return items;
|
||||
drops.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ public class GuiBase extends GuiContainer {
|
|||
if (builder.isInRect(guiLeft - 19, guiTop + 92 - offset, 12, 12, mouseX, mouseY)) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("Configure slots");
|
||||
GuiUtils.drawHoveringText(list,-5, guiTop + 70 - offset, width, height, -1, mc.fontRenderer);
|
||||
GuiUtils.drawHoveringText(list, mouseX - guiLeft , mouseY - guiTop , width, height, -1, mc.fontRenderer);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
}
|
||||
|
|
|
@ -24,12 +24,17 @@
|
|||
|
||||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.multiblock.MultiblockControllerBase;
|
||||
import reborncore.common.multiblock.MultiblockValidationException;
|
||||
import reborncore.common.multiblock.rectangular.RectangularMultiblockTileEntityBase;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.multiblocks.MultiBlockCasing;
|
||||
|
||||
public class TileMachineCasing extends RectangularMultiblockTileEntityBase {
|
||||
public class TileMachineCasing extends RectangularMultiblockTileEntityBase
|
||||
implements IToolDrop {
|
||||
|
||||
@Override
|
||||
public void onMachineActivated() {
|
||||
|
@ -85,4 +90,10 @@ public class TileMachineCasing extends RectangularMultiblockTileEntityBase {
|
|||
public void update() {
|
||||
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return BlockMachineCasing.getStackByName(world.getBlockState(pos).getValue(BlockMachineCasing.TYPE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
package techreborn.tiles.cable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
|
@ -35,6 +37,7 @@ import net.minecraftforge.common.capabilities.Capability;
|
|||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
|
@ -48,7 +51,9 @@ import java.util.List;
|
|||
* Created by modmuss50 on 19/05/2017.
|
||||
*/
|
||||
|
||||
public class TileCable extends TileEntity implements ITickable, IEnergyStorage, IListInfoProvider {
|
||||
public class TileCable extends TileEntity
|
||||
implements ITickable, IEnergyStorage, IListInfoProvider, IToolDrop {
|
||||
|
||||
public int power = 0;
|
||||
private int transferRate = 0;
|
||||
private EnumCableType cableType = null;
|
||||
|
@ -236,4 +241,10 @@ public class TileCable extends TileEntity implements ITickable, IEnergyStorage,
|
|||
+ TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(this.cableType.tier.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return getCableType().getStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.util.EnumFacing;
|
|||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.blocks.lighting.BlockLamp;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileLamp extends TilePowerAcceptor
|
||||
implements IToolDrop {
|
||||
|
@ -88,7 +87,7 @@ public class TileLamp extends TilePowerAcceptor
|
|||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.LAMP_LED, 1);
|
||||
return new ItemStack(world.getBlockState(pos).getBlock());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue