Fixed CTM version of LESU Storage.
This commit is contained in:
parent
5bfe649360
commit
41dd0468e6
4 changed files with 57 additions and 20 deletions
|
@ -95,9 +95,8 @@ public class Core {
|
||||||
worldGen = new TechRebornWorldGen();
|
worldGen = new TechRebornWorldGen();
|
||||||
worldGen.configFile = (new File(configDir, "ores.json"));
|
worldGen.configFile = (new File(configDir, "ores.json"));
|
||||||
|
|
||||||
|
CommonProxy.isChiselAround = Loader.isModLoaded("ctm");
|
||||||
TechRebornAPI.subItemRetriever = new SubItemRetriever();
|
TechRebornAPI.subItemRetriever = new SubItemRetriever();
|
||||||
//Recheck here because things break at times
|
|
||||||
|
|
||||||
// Register ModBlocks
|
// Register ModBlocks
|
||||||
ModBlocks.init();
|
ModBlocks.init();
|
||||||
// Register Fluids
|
// Register Fluids
|
||||||
|
|
|
@ -30,53 +30,72 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import prospector.shootingstar.ShootingStar;
|
import prospector.shootingstar.ShootingStar;
|
||||||
import prospector.shootingstar.model.ModelCompound;
|
import prospector.shootingstar.model.ModelCompound;
|
||||||
import reborncore.common.BaseTileBlock;
|
import reborncore.common.BaseTileBlock;
|
||||||
import techreborn.Core;
|
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
import techreborn.tiles.lesu.TileLSUStorage;
|
import techreborn.tiles.lesu.TileLSUStorage;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
/**
|
||||||
import java.util.List;
|
* Energy storage block for LESU
|
||||||
|
*/
|
||||||
public class BlockLSUStorage extends BaseTileBlock {
|
public class BlockLSUStorage extends BaseTileBlock {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
public BlockLSUStorage() {
|
public BlockLSUStorage() {
|
||||||
super(Material.IRON);
|
super(Material.IRON);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
if (Core.proxy.isCTMAvailable()) {
|
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/energy"));
|
||||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/energy/ctm"));
|
|
||||||
} else {
|
|
||||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/energy"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemstack) {
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemstack) {
|
||||||
super.onBlockPlacedBy(world, pos, state, player, itemstack);
|
super.onBlockPlacedBy(world, pos, state, player, itemstack);
|
||||||
if (world.getTileEntity(pos) instanceof TileLSUStorage) {
|
if (world.getTileEntity(pos) instanceof TileLSUStorage) {
|
||||||
((TileLSUStorage) world.getTileEntity(pos)).rebuildNetwork();
|
TileLSUStorage tile = (TileLSUStorage) world.getTileEntity(pos);
|
||||||
|
if (tile != null) {
|
||||||
|
tile.rebuildNetwork();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||||
if (world.getTileEntity(pos) instanceof TileLSUStorage) {
|
if (world.getTileEntity(pos) instanceof TileLSUStorage) {
|
||||||
((TileLSUStorage) world.getTileEntity(pos)).removeFromNetwork();
|
TileLSUStorage tile = (TileLSUStorage) world.getTileEntity(pos);
|
||||||
|
if (tile != null) {
|
||||||
|
tile.removeFromNetwork();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.breakBlock(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This gets a complete list of items dropped from this block.
|
||||||
|
*
|
||||||
|
* @param drops add all items this block drops to this drops list
|
||||||
|
* @param world The current world
|
||||||
|
* @param pos Block position in world
|
||||||
|
* @param state Current state
|
||||||
|
* @param fortune Breakers fortune level
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
List<ItemStack> items = new ArrayList<>();
|
drops.add(new ItemStack(this));
|
||||||
items.add(new ItemStack(this));
|
|
||||||
return items;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,7 +103,18 @@ public class BlockLSUStorage extends BaseTileBlock {
|
||||||
return new TileLSUStorage();
|
return new TileLSUStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta) {
|
/**
|
||||||
return block == this;
|
* Determines if another block can connect to this block
|
||||||
|
*
|
||||||
|
* @param world The current world
|
||||||
|
* @param pos The position of this block
|
||||||
|
* @param facing The side the connecting block is on
|
||||||
|
* @return True to allow another block to connect to this block
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
|
||||||
|
{
|
||||||
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
|
return this == block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ public class CommonProxy implements ICompatModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
isChiselAround = Loader.isModLoaded("chisel");
|
|
||||||
if (isChiselAround) {
|
if (isChiselAround) {
|
||||||
Core.logHelper.info("Hello chisel, shiny things will be enabled in techreborn");
|
Core.logHelper.info("Hello chisel, shiny things will be enabled in techreborn");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"ctm":{
|
||||||
|
"ctm_version": 1,
|
||||||
|
"type":"CTM",
|
||||||
|
"textures":[
|
||||||
|
"techreborn:blocks/machines/energy/ev_multi_side_ctm"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue