Merge branch '1.12' into feature/solar-panles

Conflicts:
	build.gradle
	src/main/java/techreborn/blocks/generator/BlockSolarPanel.java
	src/main/java/techreborn/blocks/lighting/BlockLamp.java
This commit is contained in:
drcrazy 2017-11-28 17:28:47 +03:00
commit eab088c094
77 changed files with 948 additions and 967 deletions

View file

@ -79,7 +79,7 @@ configurations {
compile.extendsFrom shade compile.extendsFrom shade
} }
version = "2.8.0" version = "2.9.1"
def ENV = System.getenv() def ENV = System.getenv()
if (ENV.BUILD_NUMBER) { if (ENV.BUILD_NUMBER) {
@ -87,7 +87,7 @@ if (ENV.BUILD_NUMBER) {
} }
minecraft { minecraft {
version = "1.12.2-14.23.0.2509" version = "1.12.2-14.23.0.2552"
mappings = "snapshot_20170624" mappings = "snapshot_20170624"
replace "@MODVERSION@", project.version replace "@MODVERSION@", project.version
useDepAts = true useDepAts = true
@ -122,6 +122,8 @@ dependencies {
deobfCompile 'net.industrial-craft:industrialcraft-2:2.8.26-ex112', withoutOldJEI deobfCompile 'net.industrial-craft:industrialcraft-2:2.8.26-ex112', withoutOldJEI
deobfCompile 'cofh:ThermalDynamics:1.12-2.3.5.12:universal', withoutOldJEI deobfCompile 'cofh:ThermalDynamics:1.12-2.3.5.12:universal', withoutOldJEI
deobfCompile 'cofh:ThermalExpansion:1.12-5.3.5.19:universal', withoutOldJEI deobfCompile 'cofh:ThermalExpansion:1.12-5.3.5.19:universal', withoutOldJEI
compile name: 'buildcraft', version: '7.99.12', ext: 'jar'
} }

View file

@ -37,7 +37,6 @@ import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import org.apache.commons.lang3.time.StopWatch;
import reborncore.RebornCore; import reborncore.RebornCore;
import reborncore.api.recipe.RecipeHandler; import reborncore.api.recipe.RecipeHandler;
import reborncore.common.multiblock.MultiblockEventHandler; import reborncore.common.multiblock.MultiblockEventHandler;
@ -89,16 +88,14 @@ public class Core {
public void preinit(FMLPreInitializationEvent event) throws IllegalAccessException, InstantiationException { public void preinit(FMLPreInitializationEvent event) throws IllegalAccessException, InstantiationException {
event.getModMetadata().version = ModInfo.MOD_VERSION; event.getModMetadata().version = ModInfo.MOD_VERSION;
INSTANCE = this; INSTANCE = this;
// FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
configDir = new File(new File(event.getModConfigurationDirectory(), "teamreborn"), "techreborn"); configDir = new File(new File(event.getModConfigurationDirectory(), "teamreborn"), "techreborn");
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
@ -124,7 +121,7 @@ public class Core {
@Mod.EventHandler @Mod.EventHandler
public void init(FMLInitializationEvent event) throws IllegalAccessException, InstantiationException { public void init(FMLInitializationEvent event) throws IllegalAccessException, InstantiationException {
// Registers Chest Loot // Registers Chest Loot
ModLoot.init(); // ModLoot.init();
// Multiparts // Multiparts
ModParts.init(); ModParts.init();
// Sounds // Sounds
@ -133,31 +130,21 @@ public class Core {
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.init(event); compatModule.init(event);
} }
MinecraftForge.EVENT_BUS.register(new StackWIPHandler());
MinecraftForge.EVENT_BUS.register(new BlockBreakHandler());
MinecraftForge.EVENT_BUS.register(new TRRecipeHandler());
// Recipes
StopWatch watch = new StopWatch();
watch.start();
logHelper.all(watch + " : main recipes");
watch.stop();
// Client only init, needs to be done before parts system // Client only init, needs to be done before parts system
proxy.init(event); proxy.init(event);
// WorldGen // WorldGen
worldGen.load(); worldGen.load();
GameRegistry.registerWorldGenerator(worldGen, 0); GameRegistry.registerWorldGenerator(worldGen, 0);
GameRegistry.registerWorldGenerator(new OilLakeGenerator(), 0);
// DungeonLoot.init();
// Register Gui Handler // Register Gui Handler
NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
// Multiblock events
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
// Event busses // Event busses
MinecraftForge.EVENT_BUS.register(new StackWIPHandler());
MinecraftForge.EVENT_BUS.register(new BlockBreakHandler());
MinecraftForge.EVENT_BUS.register(new TRRecipeHandler());
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
MinecraftForge.EVENT_BUS.register(new MultiblockServerTickHandler()); MinecraftForge.EVENT_BUS.register(new MultiblockServerTickHandler());
MinecraftForge.EVENT_BUS.register(new TRTickHandler()); MinecraftForge.EVENT_BUS.register(new TRTickHandler());
GameRegistry.registerWorldGenerator(new OilLakeGenerator(), 0);
MinecraftForge.EVENT_BUS.register(worldGen.retroGen); MinecraftForge.EVENT_BUS.register(worldGen.retroGen);
// Scrapbox // Scrapbox
if (BehaviorDispenseScrapbox.dispenseScrapboxes) { if (BehaviorDispenseScrapbox.dispenseScrapboxes) {
@ -178,7 +165,6 @@ public class Core {
logHelper.info(RecipeHandler.recipeList.size() + " recipes loaded"); logHelper.info(RecipeHandler.recipeList.size() + " recipes loaded");
// RecipeHandler.scanForDupeRecipes(); // RecipeHandler.scanForDupeRecipes();
// RecipeConfigManager.save(); // RecipeConfigManager.save();
//recipeCompact.saveMissingItems(configDir); //recipeCompact.saveMissingItems(configDir);
} }

View file

@ -91,6 +91,7 @@ public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
return euPerTick; return euPerTick;
} }
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override @Override
public boolean canCraft(TileEntity tile) { public boolean canCraft(TileEntity tile) {
if (tile instanceof ITileRecipeHandler) { if (tile instanceof ITileRecipeHandler) {
@ -99,6 +100,7 @@ public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
return true; return true;
} }
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override @Override
public boolean onCraft(TileEntity tile) { public boolean onCraft(TileEntity tile) {
if (tile instanceof ITileRecipeHandler) { if (tile instanceof ITileRecipeHandler) {

View file

@ -28,6 +28,7 @@ import net.minecraft.tileentity.TileEntity;
/** /**
* Created by Mark on 03/04/2016. * Created by Mark on 03/04/2016.
* @param <T> descendant of BaseRecipe
*/ */
public interface ITileRecipeHandler<T extends BaseRecipe> { public interface ITileRecipeHandler<T extends BaseRecipe> {
boolean canCraft(TileEntity tile, T recipe); boolean canCraft(TileEntity tile, T recipe);

View file

@ -70,6 +70,7 @@ public class BlockFlare extends BlockContainer {
return null; return null;
} }
@Override
public int damageDropped(IBlockState state) { public int damageDropped(IBlockState state) {
return (state.getValue(COLOR)).getMetadata(); return (state.getValue(COLOR)).getMetadata();
} }
@ -81,14 +82,17 @@ public class BlockFlare extends BlockContainer {
} }
} }
@Override
public IBlockState getStateFromMeta(int meta) { public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(COLOR, EnumDyeColor.byMetadata(meta)); return this.getDefaultState().withProperty(COLOR, EnumDyeColor.byMetadata(meta));
} }
@Override
public int getMetaFromState(IBlockState state) { public int getMetaFromState(IBlockState state) {
return (state.getValue(COLOR)).getMetadata(); return (state.getValue(COLOR)).getMetadata();
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, COLOR); return new BlockStateContainer(this, COLOR);
} }
@ -98,6 +102,7 @@ public class BlockFlare extends BlockContainer {
return false; return false;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;

View file

@ -42,7 +42,6 @@ import prospector.shootingstar.model.ModelCompound;
import reborncore.common.blocks.PropertyString; import reborncore.common.blocks.PropertyString;
import reborncore.common.multiblock.BlockMultiblockBase; import reborncore.common.multiblock.BlockMultiblockBase;
import reborncore.common.util.ArrayUtils; import reborncore.common.util.ArrayUtils;
import techreborn.Core;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
@ -64,11 +63,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
setHardness(2F); setHardness(2F);
this.setDefaultState(this.getDefaultState().withProperty(TYPE, "standard")); this.setDefaultState(this.getDefaultState().withProperty(TYPE, "standard"));
for (int i = 0; i < types.length; i++) { for (int i = 0; i < types.length; i++) {
if (Core.proxy.isCTMAvailable()) { ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure").setInvVariant("type=" + types[i]));
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure/ctm").setInvVariant("type=" + types[i]));
} else {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure").setInvVariant("type=" + types[i]));
}
} }
} }
@ -99,10 +94,16 @@ public class BlockMachineCasing extends BlockMultiblockBase {
return typesList.indexOf(state.getValue(TYPE)); return typesList.indexOf(state.getValue(TYPE));
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, TYPE); return new BlockStateContainer(this, TYPE);
} }
/**
* Provides heat info per casing for Industrial Blast Furnace
* @param state Machine casing type
* @return Integer Heat value for casing
*/
public int getHeatFromState(IBlockState state) { public int getHeatFromState(IBlockState state) {
switch (getMetaFromState(state)) { switch (getMetaFromState(state)) {
case 0: case 0:

View file

@ -111,6 +111,7 @@ public class BlockMachineFrames extends BaseBlock {
return typesList.indexOf(state.getValue(TYPE)); return typesList.indexOf(state.getValue(TYPE));
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, TYPE); return new BlockStateContainer(this, TYPE);
} }

View file

@ -113,6 +113,7 @@ public class BlockOre extends Block implements IOreNameProvider {
return getStateFromMeta(index); return getStateFromMeta(index);
} }
@Override
@Deprecated @Deprecated
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
String variant = state.getValue(VARIANTS); String variant = state.getValue(VARIANTS);
@ -230,6 +231,7 @@ public class BlockOre extends Block implements IOreNameProvider {
return oreNamesList.indexOf(state.getValue(VARIANTS)); return oreNamesList.indexOf(state.getValue(VARIANTS));
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, VARIANTS); return new BlockStateContainer(this, VARIANTS);
} }

View file

@ -151,6 +151,7 @@ public class BlockOre2 extends Block implements IOreNameProvider {
return oreNamesList.indexOf(state.getValue(VARIANTS)); return oreNamesList.indexOf(state.getValue(VARIANTS));
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
VARIANTS = new PropertyString("type", oreNamesList); VARIANTS = new PropertyString("type", oreNamesList);
return new BlockStateContainer(this, VARIANTS); return new BlockStateContainer(this, VARIANTS);

View file

@ -163,6 +163,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
return true; return true;
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
TYPE = new PropertyString("type", types); TYPE = new PropertyString("type", types);
return new BlockStateContainer(this, TYPE); return new BlockStateContainer(this, TYPE);

View file

@ -49,6 +49,7 @@ public class BlockReinforcedGlass extends BlockGlass {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this)); ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this));
} }
@Override
public int quantityDropped(Random random) { public int quantityDropped(Random random) {
return 1; return 1;
} }
@ -58,6 +59,7 @@ public class BlockReinforcedGlass extends BlockGlass {
return false; return false;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;

View file

@ -77,6 +77,7 @@ public class BlockRubberLog extends Block {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this)); ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this));
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, SAP_SIDE, HAS_SAP); return new BlockStateContainer(this, SAP_SIDE, HAS_SAP);
} }
@ -127,6 +128,7 @@ public class BlockRubberLog extends Block {
return true; return true;
} }
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
int i = 4; int i = 4;
int j = i + 1; int j = i + 1;

View file

@ -109,6 +109,7 @@ public class BlockStorage extends BaseBlock {
return typesList.indexOf(state.getValue(TYPE)); return typesList.indexOf(state.getValue(TYPE));
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, TYPE); return new BlockStateContainer(this, TYPE);
} }

View file

@ -133,6 +133,7 @@ public class BlockStorage2 extends BaseBlock {
return 30F; return 30F;
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, TYPE); return new BlockStateContainer(this, TYPE);
} }

View file

@ -193,6 +193,7 @@ public class BlockCable extends BlockContainer {
return false; return false;
} }
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
state = state.getActualState(source, pos); state = state.getActualState(source, pos);
float minX = state.getValue(WEST) ? 0.0F : 0.3125F; float minX = state.getValue(WEST) ? 0.0F : 0.3125F;

View file

@ -31,7 +31,6 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import techreborn.Core;
public class BlockFluidTechReborn extends BlockFluidBase { public class BlockFluidTechReborn extends BlockFluidBase {
@ -41,7 +40,6 @@ public class BlockFluidTechReborn extends BlockFluidBase {
super(fluid, material); super(fluid, material);
setUnlocalizedName(name); setUnlocalizedName(name);
this.name = name; this.name = name;
Core.proxy.registerFluidBlockRendering(this, name);
} }
@Override @Override

View file

@ -0,0 +1,108 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.blocks.generator;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import reborncore.common.BaseTileBlock;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.generator.TileSolarPanel;
/**
* Created by modmuss50 on 25/02/2016.
*/
public class BlockSolarPanel extends BaseTileBlock {
public static PropertyBool ACTIVE = PropertyBool.create("active");
public BlockSolarPanel() {
super(Material.IRON);
setCreativeTab(TechRebornCreativeTab.instance);
this.setDefaultState(this.getDefaultState().withProperty(ACTIVE, false));
setHardness(2.0F);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/generators"));
}
@Override
protected BlockStateContainer createBlockState() {
ACTIVE = PropertyBool.create("active");
return new BlockStateContainer(this, ACTIVE);
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(ACTIVE, meta != 0);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(ACTIVE) ? 1 : 0;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileSolarPanel();
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block neighborBlock, BlockPos p_189540_5_) {
if (worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering()
&& worldIn.isDaytime()) {
worldIn.setBlockState(pos,
worldIn.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, true));
} else {
worldIn.setBlockState(pos,
worldIn.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, false));
}
}
@Override
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
float hitZ, int meta, EntityLivingBase placer) {
if (!worldIn.isRemote) {
if (worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering() && worldIn.isDaytime()) {
return this.getDefaultState().withProperty(ACTIVE, true);
} else {
return this.getDefaultState().withProperty(ACTIVE, false);
}
} else {
return this.getDefaultState().withProperty(ACTIVE, false);
}
}
}

View file

@ -78,6 +78,7 @@ public class BlockLamp extends BaseTileBlock {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/lighting")); ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/lighting"));
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
FACING = PropertyDirection.create("facing"); FACING = PropertyDirection.create("facing");
ACTIVE = PropertyBool.create("active"); ACTIVE = PropertyBool.create("active");

View file

@ -113,6 +113,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
return super.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ); return super.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ);
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
FACING = PropertyDirection.create("facing", Facings.ALL); FACING = PropertyDirection.create("facing", Facings.ALL);
return new BlockStateContainer(this, FACING); return new BlockStateContainer(this, FACING);
@ -220,10 +221,12 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
return aenumfacing[rand.nextInt(aenumfacing.length)]; return aenumfacing[rand.nextInt(aenumfacing.length)];
} }
@Override
public boolean apply(EnumFacing p_apply_1_) { public boolean apply(EnumFacing p_apply_1_) {
return p_apply_1_ != null; return p_apply_1_ != null;
} }
@Override
public Iterator<EnumFacing> iterator() { public Iterator<EnumFacing> iterator() {
return Iterators.forArray(this.facings()); return Iterators.forArray(this.facings());
} }

View file

@ -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;
} }
} }

View file

@ -76,6 +76,7 @@ public abstract class BlockTransformer extends BaseTileBlock {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/energy")); ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/energy"));
} }
@Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
FACING = PropertyDirection.create("facing", Facings.ALL); FACING = PropertyDirection.create("facing", Facings.ALL);
return new BlockStateContainer(this, FACING); return new BlockStateContainer(this, FACING);
@ -267,10 +268,12 @@ public abstract class BlockTransformer extends BaseTileBlock {
return aenumfacing[rand.nextInt(aenumfacing.length)]; return aenumfacing[rand.nextInt(aenumfacing.length)];
} }
@Override
public boolean apply(EnumFacing p_apply_1_) { public boolean apply(EnumFacing p_apply_1_) {
return p_apply_1_ != null; return p_apply_1_ != null;
} }
@Override
public Iterator<EnumFacing> iterator() { public Iterator<EnumFacing> iterator() {
return Iterators.forArray(this.facings()); return Iterators.forArray(this.facings());
} }

View file

@ -61,6 +61,7 @@ public class RegisterItemJsons {
register(ModItems.MANUAL, "misc/manual"); register(ModItems.MANUAL, "misc/manual");
register(ModItems.DEBUG, "misc/debug"); register(ModItems.DEBUG, "misc/debug");
register(ModBlocks.RUBBER_SAPLING, "misc/rubber_sapling"); register(ModBlocks.RUBBER_SAPLING, "misc/rubber_sapling");
register(ModItems.MISSING_RECIPE_PLACEHOLDER, "misc/missing_recipe");
register(ModItems.STEEL_DRILL, "tool/steel_drill"); register(ModItems.STEEL_DRILL, "tool/steel_drill");
register(ModItems.DIAMOND_DRILL, "tool/diamond_drill"); register(ModItems.DIAMOND_DRILL, "tool/diamond_drill");

View file

@ -44,6 +44,8 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
import techreborn.Core; import techreborn.Core;
import techreborn.client.container.builder.slot.FilteredSlot; import techreborn.client.container.builder.slot.FilteredSlot;
import techreborn.client.container.builder.slot.UpgradeSlot; import techreborn.client.container.builder.slot.UpgradeSlot;
import techreborn.compat.CompatManager;
import techreborn.utils.IC2ItemCharger;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.IntConsumer; import java.util.function.IntConsumer;
@ -89,7 +91,7 @@ public class ContainerTileInventoryBuilder {
public ContainerTileInventoryBuilder energySlot(final int index, final int x, final int y) { public ContainerTileInventoryBuilder energySlot(final int index, final int x, final int y) {
this.parent.slots.add(new FilteredSlot(this.tile, index, x, y) this.parent.slots.add(new FilteredSlot(this.tile, index, x, y)
.setFilter(stack -> stack.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.UP) .setFilter(stack -> stack.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.UP)
|| stack.getItem() instanceof IEnergyInterfaceItem)); || stack.getItem() instanceof IEnergyInterfaceItem || (CompatManager.isIC2Loaded && IC2ItemCharger.isIC2PoweredItem(stack))));
return this; return this;
} }
@ -124,6 +126,7 @@ public class ContainerTileInventoryBuilder {
* @param supplier The supplier must supply a variable holding inside a Short, it * @param supplier The supplier must supply a variable holding inside a Short, it
* will be truncated by force. * will be truncated by force.
* @param setter The setter to call when the variable has been updated. * @param setter The setter to call when the variable has been updated.
* @return ContainerTileInventoryBuilder Inventory which will do the sync
*/ */
public ContainerTileInventoryBuilder syncShortValue(final IntSupplier supplier, final IntConsumer setter) { public ContainerTileInventoryBuilder syncShortValue(final IntSupplier supplier, final IntConsumer setter) {
this.parent.shortValues.add(Pair.of(supplier, setter)); this.parent.shortValues.add(Pair.of(supplier, setter));
@ -134,6 +137,7 @@ public class ContainerTileInventoryBuilder {
* @param supplier The supplier it can supply a variable holding in an Integer it * @param supplier The supplier it can supply a variable holding in an Integer it
* will be split inside multiples shorts. * will be split inside multiples shorts.
* @param setter The setter to call when the variable has been updated. * @param setter The setter to call when the variable has been updated.
* @return ContainerTileInventoryBuilder Inventory which will do the sync
*/ */
public ContainerTileInventoryBuilder syncIntegerValue(final IntSupplier supplier, final IntConsumer setter) { public ContainerTileInventoryBuilder syncIntegerValue(final IntSupplier supplier, final IntConsumer setter) {
this.parent.integerValues.add(Pair.of(supplier, setter)); this.parent.integerValues.add(Pair.of(supplier, setter));

View file

@ -353,6 +353,7 @@ public class TRBuilder extends GuiBuilder {
} }
} }
@Override
public void drawSlot(GuiScreen gui, int posX, int posY) { public void drawSlot(GuiScreen gui, int posX, int posY) {
Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET);
gui.drawTexturedModalRect(posX, posY, 150, 0, 18, 18); gui.drawTexturedModalRect(posX, posY, 150, 0, 18, 18);
@ -387,6 +388,7 @@ public class TRBuilder extends GuiBuilder {
} }
} }
@Override
public void drawOutputSlot(GuiScreen gui, int posX, int posY) { public void drawOutputSlot(GuiScreen gui, int posX, int posY) {
Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET);
gui.drawTexturedModalRect(posX, posY, 150, 18, 26, 26); gui.drawTexturedModalRect(posX, posY, 150, 18, 26, 26);

View file

@ -232,6 +232,7 @@ public class GuiAutoCrafting extends GuiBase {
this.recipeSlector.slotClicked(slotIn); this.recipeSlector.slotClicked(slotIn);
} }
@Override
public void onGuiClosed() { public void onGuiClosed() {
this.recipeSlector.removed(); this.recipeSlector.removed();
super.onGuiClosed(); super.onGuiClosed();

View file

@ -24,11 +24,17 @@
package techreborn.compat.buildcraft; package techreborn.compat.buildcraft;
import buildcraft.builders.BCBuildersBlocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import reborncore.common.util.RebornCraftingHelper;
import reborncore.common.util.RecipeRemover;
import techreborn.compat.CompatConfigs;
import techreborn.compat.ICompatModule; import techreborn.compat.ICompatModule;
import techreborn.init.ModItems;
/** /**
* Created by Mark on 02/06/2017. * Created by Mark on 02/06/2017.
@ -47,16 +53,16 @@ public class BuildcraftBuildersCompat implements ICompatModule {
@Override @Override
public void postInit(FMLPostInitializationEvent event) { public void postInit(FMLPostInitializationEvent event) {
// if (expensiveQuarry) { if (CompatConfigs.expensiveQuarry) {
// RecipeRemover.removeAnyRecipe(new ItemStack(BCBuildersBlocks.quarry)); RecipeRemover.removeAnyRecipe(new ItemStack(BCBuildersBlocks.quarry));
// RebornCraftingHelper.addShapedOreRecipe(new ItemStack(BCBuildersBlocks.quarry), RebornCraftingHelper.addShapedOreRecipe(new ItemStack(BCBuildersBlocks.quarry),
// "IAI", "GIG", "DED", "IAI", "GIG", "DED",
// 'I', "gearIron", 'I', "gearIron",
// 'G', "gearGold", 'G', "gearGold",
// 'D', "gearDiamond", 'D', "gearDiamond",
// 'A', "circuitAdvanced", 'A', "circuitAdvanced",
// 'E', new ItemStack(ModItems.DIAMOND_DRILL)); 'E', new ItemStack(ModItems.DIAMOND_DRILL));
// } }
} }
@Override @Override

View file

@ -24,10 +24,16 @@
package techreborn.compat.buildcraft; package techreborn.compat.buildcraft;
import buildcraft.api.fuels.IFuel;
import buildcraft.lib.fluid.FuelRegistry;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import reborncore.common.RebornCoreConfig;
import techreborn.api.generator.EFluidGenerator;
import techreborn.api.generator.GeneratorRecipeHelper;
import techreborn.compat.CompatConfigs;
import techreborn.compat.ICompatModule; import techreborn.compat.ICompatModule;
/** /**
@ -47,11 +53,11 @@ public class BuildcraftCompat implements ICompatModule {
@Override @Override
public void postInit(FMLPostInitializationEvent event) { public void postInit(FMLPostInitializationEvent event) {
// if (allowBCFuels) { if (CompatConfigs.allowBCFuels) {
// for (IFuel fuel : FuelRegistry.INSTANCE.getFuels()) { for (IFuel fuel : FuelRegistry.INSTANCE.getFuels()) {
// FluidPowerManager.fluidPowerValues.put(fuel.getFluid(), (double) fuel.getPowerPerCycle() / RebornCoreConfig.euPerFU); GeneratorRecipeHelper.registerFluidRecipe(EFluidGenerator.THERMAL, fuel.getFluid().getFluid(), (int) (fuel.getPowerPerCycle() / RebornCoreConfig.euPerFU));
// } }
// } }
} }
@Override @Override

View file

@ -56,7 +56,7 @@ public class CTScrapbox {
@ZenMethod @ZenMethod
public static void removeRecipe(IItemStack output) { public static void removeRecipe(IItemStack output) {
ScrapboxList.stacks.remove(output); ScrapboxList.stacks.remove(CraftTweakerCompat.toStack(output));
CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName())); CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName()));
} }

View file

@ -53,7 +53,7 @@ public class RecipesIC2 implements ICompatModule {
@Override @Override
public void init(FMLInitializationEvent event) { public void init(FMLInitializationEvent event) {
recipeDuplicateList.add(new RecipeDuplicate(new ItemStack(ModBlocks.MACHINE_FRAMES, 0, 1), IC2Items.getItem("resource", "machine"))); recipeDuplicateList.add(new RecipeDuplicate(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 0), IC2Items.getItem("resource", "machine")));
for (RecipeDuplicate duplicate : recipeDuplicateList) { for (RecipeDuplicate duplicate : recipeDuplicateList) {
duplicate.add(); duplicate.add();
@ -64,7 +64,6 @@ public class RecipesIC2 implements ICompatModule {
public void postInit(FMLPostInitializationEvent event) { public void postInit(FMLPostInitializationEvent event) {
RebornCraftingHelper.addShapelessRecipe(ItemParts.getPartByName("rubber"), IC2Items.getItem("crafting", "rubber")); RebornCraftingHelper.addShapelessRecipe(ItemParts.getPartByName("rubber"), IC2Items.getItem("crafting", "rubber"));
RebornCraftingHelper.addShapelessRecipe(IC2Items.getItem("crafting", "rubber"), ItemParts.getPartByName("rubber")); RebornCraftingHelper.addShapelessRecipe(IC2Items.getItem("crafting", "rubber"), ItemParts.getPartByName("rubber"));
RebornCraftingHelper.addShapelessRecipe(IC2Items.getItem("electric_wrench"), new ItemStack(ModItems.WRENCH), IC2Items.getItem("crafting", "small_power_unit")); RebornCraftingHelper.addShapelessRecipe(IC2Items.getItem("electric_wrench"), new ItemStack(ModItems.WRENCH), IC2Items.getItem("crafting", "small_power_unit"));
} }
@ -74,9 +73,7 @@ public class RecipesIC2 implements ICompatModule {
} }
public class RecipeDuplicate { public class RecipeDuplicate {
ItemStack stack1; ItemStack stack1;
ItemStack stack2; ItemStack stack2;
public RecipeDuplicate(ItemStack stack1, ItemStack stack2) { public RecipeDuplicate(ItemStack stack1, ItemStack stack2) {
@ -85,12 +82,8 @@ public class RecipesIC2 implements ICompatModule {
} }
public void add() { public void add() {
RebornCraftingHelper.addShapelessRecipe(stack2, stack1); RebornCraftingHelper.addShapelessRecipe(stack2, stack1);
RebornCraftingHelper.addShapelessRecipe(stack1, stack2); RebornCraftingHelper.addShapelessRecipe(stack1, stack2);
} }
} }
} }

View file

@ -38,7 +38,6 @@ import reborncore.common.powerSystem.PowerSystem;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.awt.*; import java.awt.*;
import java.text.NumberFormat;
import java.util.List; import java.util.List;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")

View file

@ -32,6 +32,7 @@ import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@SuppressWarnings("deprecation")
public class AssemblingMachineRecipeHandler implements IRecipeHandler<AssemblingMachineRecipe> { public class AssemblingMachineRecipeHandler implements IRecipeHandler<AssemblingMachineRecipe> {
@Nonnull @Nonnull
private final IJeiHelpers jeiHelpers; private final IJeiHelpers jeiHelpers;

View file

@ -25,7 +25,7 @@
package techreborn.compat.jei.fusionReactor; package techreborn.compat.jei.fusionReactor;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import techreborn.api.reactor.FusionReactorRecipe; import techreborn.api.reactor.FusionReactorRecipe;
@ -34,7 +34,7 @@ import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.Arrays; import java.util.Arrays;
public class FusionReactorRecipeWrapper extends BlankRecipeWrapper { public class FusionReactorRecipeWrapper implements IRecipeWrapper {
private final FusionReactorRecipe baseRecipe; private final FusionReactorRecipe baseRecipe;
public FusionReactorRecipeWrapper(FusionReactorRecipe baseRecipe) { public FusionReactorRecipeWrapper(FusionReactorRecipe baseRecipe) {
@ -42,9 +42,7 @@ public class FusionReactorRecipeWrapper extends BlankRecipeWrapper {
} }
@Override @Override
public void getIngredients( public void getIngredients(@Nonnull IIngredients ingredients) {
@Nonnull
IIngredients ingredients) {
ingredients.setInputs(ItemStack.class, Arrays.asList(baseRecipe.getTopInput(), baseRecipe.getBottomInput())); ingredients.setInputs(ItemStack.class, Arrays.asList(baseRecipe.getTopInput(), baseRecipe.getBottomInput()));
ingredients.setOutput(ItemStack.class, baseRecipe.getOutput()); ingredients.setOutput(ItemStack.class, baseRecipe.getOutput());
} }
@ -58,10 +56,7 @@ public class FusionReactorRecipeWrapper extends BlankRecipeWrapper {
} }
@Override @Override
public void drawInfo( public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
@Nonnull RecipeUtil.drawInfo(minecraft, 0, 67, baseRecipe.getStartEU(), baseRecipe.getEuTick(), baseRecipe.getTickTime());
Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
RecipeUtil.drawInfo(minecraft, 0, 67, baseRecipe.getStartEU(), baseRecipe.getEuTick(),
baseRecipe.getTickTime());
} }
} }

View file

@ -30,6 +30,7 @@ import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@SuppressWarnings({"deprecation" })
public class RollingMachineRecipeHandler implements IRecipeHandler<RollingMachineRecipeWrapper> { public class RollingMachineRecipeHandler implements IRecipeHandler<RollingMachineRecipeWrapper> {
@Nonnull @Nonnull
@Override @Override

View file

@ -52,13 +52,13 @@ public class RollingMachineRecipeWrapper implements IRecipeWrapper {
IJeiHelpers jeiHelpers, IRecipe baseRecipe) { IJeiHelpers jeiHelpers, IRecipe baseRecipe) {
IRecipeWrapper recipeWrapper; IRecipeWrapper recipeWrapper;
if (baseRecipe instanceof ShapelessRecipes) { if (baseRecipe instanceof ShapelessRecipes) {
recipeWrapper = new ShapelessRecipeWrapper(jeiHelpers, baseRecipe); recipeWrapper = new ShapelessRecipeWrapper<IRecipe>(jeiHelpers, baseRecipe);
} else if (baseRecipe instanceof ShapedRecipes) { } else if (baseRecipe instanceof ShapedRecipes) {
recipeWrapper = new ShapedRecipesWrapper(jeiHelpers, (ShapedRecipes) baseRecipe); recipeWrapper = new ShapedRecipesWrapper(jeiHelpers, (ShapedRecipes) baseRecipe);
} else if (baseRecipe instanceof ShapedOreRecipe) { } else if (baseRecipe instanceof ShapedOreRecipe) {
recipeWrapper = new ShapedOreRecipeWrapper(jeiHelpers, (ShapedOreRecipe) baseRecipe); recipeWrapper = new ShapedOreRecipeWrapper(jeiHelpers, (ShapedOreRecipe) baseRecipe);
} else if (baseRecipe instanceof ShapelessOreRecipe) { } else if (baseRecipe instanceof ShapelessOreRecipe) {
recipeWrapper = new ShapelessRecipeWrapper(jeiHelpers, baseRecipe); recipeWrapper = new ShapelessRecipeWrapper<IRecipe>(jeiHelpers, baseRecipe);
} else { } else {
return null; return null;
} }

View file

@ -0,0 +1,109 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.events;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import techreborn.blocks.fluid.BlockFluidTechReborn;
import techreborn.init.ModFluids;
import techreborn.lib.ModInfo;
/**
* @author drcrazy
*
*/
@SideOnly(Side.CLIENT)
public class FluidBlockModelHandler {
@SubscribeEvent
public void registerModels(ModelRegistryEvent event) {
registerFluidBlockModel(ModFluids.BLOCK_BERYLLIUM);
registerFluidBlockModel(ModFluids.BLOCK_CALCIUM);
registerFluidBlockModel(ModFluids.BLOCK_CALCIUM_CARBONATE);
registerFluidBlockModel(ModFluids.BLOCK_CHLORITE);
registerFluidBlockModel(ModFluids.BLOCK_DEUTERIUM);
registerFluidBlockModel(ModFluids.BLOCK_GLYCERYL);
registerFluidBlockModel(ModFluids.BLOCK_HELIUM);
registerFluidBlockModel(ModFluids.BLOCK_HELIUM_3);
registerFluidBlockModel(ModFluids.BLOCK_HELIUMPLASMA);
registerFluidBlockModel(ModFluids.BLOCK_HYDROGEN);
registerFluidBlockModel(ModFluids.BLOCK_LITHIUM);
registerFluidBlockModel(ModFluids.BLOCK_MERCURY);
registerFluidBlockModel(ModFluids.BLOCK_METHANE);
registerFluidBlockModel(ModFluids.BLOCK_NITROCOAL_FUEL);
registerFluidBlockModel(ModFluids.BLOCK_NITROFUEL);
registerFluidBlockModel(ModFluids.BLOCK_NITROGEN);
registerFluidBlockModel(ModFluids.BLOCK_NITROGENDIOXIDE);
registerFluidBlockModel(ModFluids.BLOCK_POTASSIUM);
registerFluidBlockModel(ModFluids.BLOCK_SILICON);
registerFluidBlockModel(ModFluids.BLOCK_SODIUM);
registerFluidBlockModel(ModFluids.BLOCK_SODIUMPERSULFATE);
registerFluidBlockModel(ModFluids.BLOCK_TRITIUM);
registerFluidBlockModel(ModFluids.BLOCK_WOLFRAMIUM);
registerFluidBlockModel(ModFluids.BLOCK_CARBON);
registerFluidBlockModel(ModFluids.BLOCK_CARBON_FIBER);
registerFluidBlockModel(ModFluids.BLOCK_NITRO_CARBON);
registerFluidBlockModel(ModFluids.BLOCK_SULFUR);
registerFluidBlockModel(ModFluids.BLOCK_SODIUM_SULFIDE);
registerFluidBlockModel(ModFluids.BLOCK_DIESEL);
registerFluidBlockModel(ModFluids.BLOCK_NITRO_DIESEL);
registerFluidBlockModel(ModFluids.BLOCK_OIL);
registerFluidBlockModel(ModFluids.BLOCK_SULFURIC_ACID);
registerFluidBlockModel(ModFluids.BLOCK_COMPRESSED_AIR);
registerFluidBlockModel(ModFluids.BLOCK_ELECTROLYZED_WATER);
}
private static void registerFluidBlockModel(BlockFluidTechReborn block) {
String name = block.getUnlocalizedName().substring(5).toLowerCase();
Item item = Item.getItemFromBlock(block);
ModelResourceLocation location = new ModelResourceLocation(
new ResourceLocation(ModInfo.MOD_ID.toLowerCase(), "fluids"), name);
ModelLoader.registerItemVariants(item);
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return location;
}
});
ModelLoader.setCustomStateMapper(block, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return location;
}
});
}
}

View file

@ -29,7 +29,6 @@ import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import reborncore.RebornRegistry; import reborncore.RebornRegistry;
import techreborn.blocks.fluid.BlockFluidBase;
import techreborn.blocks.fluid.BlockFluidTechReborn; import techreborn.blocks.fluid.BlockFluidTechReborn;
import techreborn.blocks.fluid.TechRebornFluid; import techreborn.blocks.fluid.TechRebornFluid;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
@ -37,112 +36,112 @@ import techreborn.lib.ModInfo;
public class ModFluids { public class ModFluids {
public static Fluid BERYLLIUM = new TechRebornFluid("fluidberylium"); public static Fluid BERYLLIUM = new TechRebornFluid("fluidberylium");
public static BlockFluidBase BLOCK_BERYLLIUM; public static BlockFluidTechReborn BLOCK_BERYLLIUM;
public static Fluid CALCIUM = new TechRebornFluid("fluidcalcium"); public static Fluid CALCIUM = new TechRebornFluid("fluidcalcium");
public static BlockFluidBase BLOCK_CALCIUM; public static BlockFluidTechReborn BLOCK_CALCIUM;
public static Fluid CALCIUM_CARBONATE = new TechRebornFluid("fluidcalciumcarbonate"); public static Fluid CALCIUM_CARBONATE = new TechRebornFluid("fluidcalciumcarbonate");
public static BlockFluidBase BLOCK_CALCIUM_CARBONATE; public static BlockFluidTechReborn BLOCK_CALCIUM_CARBONATE;
public static Fluid CHLORITE = new TechRebornFluid("fluidchlorite"); public static Fluid CHLORITE = new TechRebornFluid("fluidchlorite");
public static BlockFluidBase BLOCK_CHLORITE; public static BlockFluidTechReborn BLOCK_CHLORITE;
public static Fluid DEUTERIUM = new TechRebornFluid("fluiddeuterium"); public static Fluid DEUTERIUM = new TechRebornFluid("fluiddeuterium");
public static BlockFluidBase BLOCK_DEUTERIUM; public static BlockFluidTechReborn BLOCK_DEUTERIUM;
public static Fluid GLYCERYL = new TechRebornFluid("fluidglyceryl"); public static Fluid GLYCERYL = new TechRebornFluid("fluidglyceryl");
public static BlockFluidBase BLOCK_GLYCERYL; public static BlockFluidTechReborn BLOCK_GLYCERYL;
public static Fluid HELIUM = new TechRebornFluid("fluidhelium"); public static Fluid HELIUM = new TechRebornFluid("fluidhelium");
public static BlockFluidBase BLOCK_HELIUM; public static BlockFluidTechReborn BLOCK_HELIUM;
public static Fluid HELIUM_3 = new TechRebornFluid("fluidhelium3"); public static Fluid HELIUM_3 = new TechRebornFluid("fluidhelium3");
public static BlockFluidBase BLOCK_HELIUM_3; public static BlockFluidTechReborn BLOCK_HELIUM_3;
public static Fluid HELIUMPLASMA = new TechRebornFluid("fluidheliumplasma"); public static Fluid HELIUMPLASMA = new TechRebornFluid("fluidheliumplasma");
public static BlockFluidBase BLOCK_HELIUMPLASMA; public static BlockFluidTechReborn BLOCK_HELIUMPLASMA;
public static Fluid HYDROGEN = new TechRebornFluid("fluidhydrogen"); public static Fluid HYDROGEN = new TechRebornFluid("fluidhydrogen");
public static BlockFluidBase BLOCK_HYDROGEN; public static BlockFluidTechReborn BLOCK_HYDROGEN;
public static Fluid LITHIUM = new TechRebornFluid("fluidlithium"); public static Fluid LITHIUM = new TechRebornFluid("fluidlithium");
public static BlockFluidBase BLOCK_LITHIUM; public static BlockFluidTechReborn BLOCK_LITHIUM;
public static Fluid MERCURY = new TechRebornFluid("fluidmercury"); public static Fluid MERCURY = new TechRebornFluid("fluidmercury");
public static BlockFluidBase BLOCK_MERCURY; public static BlockFluidTechReborn BLOCK_MERCURY;
public static Fluid METHANE = new TechRebornFluid("fluidmethane"); public static Fluid METHANE = new TechRebornFluid("fluidmethane");
public static BlockFluidBase BLOCK_METHANE; public static BlockFluidTechReborn BLOCK_METHANE;
public static Fluid NITROCOAL_FUEL = new TechRebornFluid("fluidnitrocoalfuel"); public static Fluid NITROCOAL_FUEL = new TechRebornFluid("fluidnitrocoalfuel");
public static BlockFluidBase BLOCK_NITROCOAL_FUEL; public static BlockFluidTechReborn BLOCK_NITROCOAL_FUEL;
public static Fluid NITROFUEL = new TechRebornFluid("fluidnitrofuel"); public static Fluid NITROFUEL = new TechRebornFluid("fluidnitrofuel");
public static BlockFluidBase BLOCK_NITROFUEL; public static BlockFluidTechReborn BLOCK_NITROFUEL;
public static Fluid NITROGEN = new TechRebornFluid("fluidnitrogen"); public static Fluid NITROGEN = new TechRebornFluid("fluidnitrogen");
public static BlockFluidBase BLOCK_NITROGEN; public static BlockFluidTechReborn BLOCK_NITROGEN;
public static Fluid NITROGENDIOXIDE = new TechRebornFluid("fluidnitrogendioxide"); public static Fluid NITROGENDIOXIDE = new TechRebornFluid("fluidnitrogendioxide");
public static BlockFluidBase BLOCK_NITROGENDIOXIDE; public static BlockFluidTechReborn BLOCK_NITROGENDIOXIDE;
public static Fluid POTASSIUM = new TechRebornFluid("fluidpotassium"); public static Fluid POTASSIUM = new TechRebornFluid("fluidpotassium");
public static BlockFluidBase BLOCK_POTASSIUM; public static BlockFluidTechReborn BLOCK_POTASSIUM;
public static Fluid SILICON = new TechRebornFluid("fluidsilicon"); public static Fluid SILICON = new TechRebornFluid("fluidsilicon");
public static BlockFluidBase BLOCK_SILICON; public static BlockFluidTechReborn BLOCK_SILICON;
public static Fluid SODIUM = new TechRebornFluid("fluidsodium"); public static Fluid SODIUM = new TechRebornFluid("fluidsodium");
public static BlockFluidBase BLOCK_SODIUM; public static BlockFluidTechReborn BLOCK_SODIUM;
public static Fluid SODIUMPERSULFATE = new TechRebornFluid("fluidsodiumpersulfate"); public static Fluid SODIUMPERSULFATE = new TechRebornFluid("fluidsodiumpersulfate");
public static BlockFluidBase BLOCK_SODIUMPERSULFATE; public static BlockFluidTechReborn BLOCK_SODIUMPERSULFATE;
public static Fluid TRITIUM = new TechRebornFluid("fluidtritium"); public static Fluid TRITIUM = new TechRebornFluid("fluidtritium");
public static BlockFluidBase BLOCK_TRITIUM; public static BlockFluidTechReborn BLOCK_TRITIUM;
public static Fluid WOLFRAMIUM = new TechRebornFluid("fluidwolframium"); public static Fluid WOLFRAMIUM = new TechRebornFluid("fluidwolframium");
public static BlockFluidBase BLOCK_WOLFRAMIUM; public static BlockFluidTechReborn BLOCK_WOLFRAMIUM;
public static Fluid CARBON = new TechRebornFluid("fluidcarbon"); public static Fluid CARBON = new TechRebornFluid("fluidcarbon");
public static BlockFluidBase BLOCK_CARBON; public static BlockFluidTechReborn BLOCK_CARBON;
public static Fluid CARBON_FIBER = new TechRebornFluid("fluidcarbonfiber"); public static Fluid CARBON_FIBER = new TechRebornFluid("fluidcarbonfiber");
public static BlockFluidBase BLOCK_CARBON_FIBER; public static BlockFluidTechReborn BLOCK_CARBON_FIBER;
public static Fluid NITRO_CARBON = new TechRebornFluid("fluidnitrocarbon"); public static Fluid NITRO_CARBON = new TechRebornFluid("fluidnitrocarbon");
public static BlockFluidBase BLOCK_NITRO_CARBON; public static BlockFluidTechReborn BLOCK_NITRO_CARBON;
public static Fluid SULFUR = new TechRebornFluid("fluidSulfur"); public static Fluid SULFUR = new TechRebornFluid("fluidSulfur");
public static BlockFluidBase BLOCK_SULFUR; public static BlockFluidTechReborn BLOCK_SULFUR;
public static Fluid SODIUM_SULFIDE = new TechRebornFluid("fluidsodiumSulfide"); public static Fluid SODIUM_SULFIDE = new TechRebornFluid("fluidsodiumSulfide");
public static BlockFluidBase BLOCK_SODIUM_SULFIDE; public static BlockFluidTechReborn BLOCK_SODIUM_SULFIDE;
public static Fluid DIESEL = new TechRebornFluid("fluiddiesel"); public static Fluid DIESEL = new TechRebornFluid("fluiddiesel");
public static BlockFluidBase BLOCK_DIESEL; public static BlockFluidTechReborn BLOCK_DIESEL;
public static Fluid NITRO_DIESEL = new TechRebornFluid("fluidnitrodiesel"); public static Fluid NITRO_DIESEL = new TechRebornFluid("fluidnitrodiesel");
public static BlockFluidBase BLOCK_NITRO_DIESEL; public static BlockFluidTechReborn BLOCK_NITRO_DIESEL;
public static Fluid OIL = new TechRebornFluid("fluidoil"); public static Fluid OIL = new TechRebornFluid("fluidoil");
public static BlockFluidBase BLOCK_OIL; public static BlockFluidTechReborn BLOCK_OIL;
public static Fluid SULFURIC_ACID = new TechRebornFluid("fluidsulfuricacid"); public static Fluid SULFURIC_ACID = new TechRebornFluid("fluidsulfuricacid");
public static BlockFluidBase BLOCK_SULFURIC_ACID; public static BlockFluidTechReborn BLOCK_SULFURIC_ACID;
public static Fluid COMPRESSED_AIR = new TechRebornFluid("fluidcompressedair"); public static Fluid COMPRESSED_AIR = new TechRebornFluid("fluidcompressedair");
public static BlockFluidBase BLOCK_COMPRESSED_AIR; public static BlockFluidTechReborn BLOCK_COMPRESSED_AIR;
public static Fluid ELECTROLYZED_WATER = new TechRebornFluid("fluidelectrolyzedwater"); public static Fluid ELECTROLYZED_WATER = new TechRebornFluid("fluidelectrolyzedwater");
public static BlockFluidBase BLOCK_ELECTROLYZED_WATER; public static BlockFluidTechReborn BLOCK_ELECTROLYZED_WATER;
public static void init() { public static void init() {
FluidRegistry.registerFluid(BERYLLIUM); FluidRegistry.registerFluid(BERYLLIUM);
BLOCK_BERYLLIUM = new BlockFluidTechReborn(BERYLLIUM, Material.WATER, "techreborn.berylium"); BLOCK_BERYLLIUM = new BlockFluidTechReborn(BERYLLIUM, Material.WATER, "techreborn.berylium");
registerBlock(BLOCK_BERYLLIUM, registerBlock(BLOCK_BERYLLIUM, ModInfo.MOD_ID + "_" + BLOCK_BERYLLIUM.getUnlocalizedName().substring(5));
ModInfo.MOD_ID + "_" + BLOCK_BERYLLIUM.getUnlocalizedName().substring(5));
FluidRegistry.registerFluid(CALCIUM); FluidRegistry.registerFluid(CALCIUM);
BLOCK_CALCIUM = new BlockFluidTechReborn(CALCIUM, Material.WATER, "techreborn.calcium"); BLOCK_CALCIUM = new BlockFluidTechReborn(CALCIUM, Material.WATER, "techreborn.calcium");

View file

@ -329,7 +329,7 @@ public class ModItems {
registerItem(CLOAKING_DEVICE, "cloakingdevice"); registerItem(CLOAKING_DEVICE, "cloakingdevice");
MISSING_RECIPE_PLACEHOLDER = new ItemMissingRecipe().setUnlocalizedName("missingRecipe"); MISSING_RECIPE_PLACEHOLDER = new ItemMissingRecipe().setUnlocalizedName("missingRecipe");
registerItem(MISSING_RECIPE_PLACEHOLDER, "mssingRecipe"); registerItem(MISSING_RECIPE_PLACEHOLDER, "missingRecipe");
DEBUG = new ItemDebugTool(); DEBUG = new ItemDebugTool();
registerItem(DEBUG, "debug"); registerItem(DEBUG, "debug");

View file

@ -162,7 +162,7 @@ public class CraftingTableRecipes extends RecipeMethods {
registerShaped(getStack(IC2Duplicates.IRON_FURNACE), "III", "I I", "III", 'I', "ingotIron"); registerShaped(getStack(IC2Duplicates.IRON_FURNACE), "III", "I I", "III", 'I', "ingotIron");
registerShaped(getStack(IC2Duplicates.IRON_FURNACE), " I ", "I I", "IFI", 'I', "ingotIron", 'F', getStack(Blocks.FURNACE)); registerShaped(getStack(IC2Duplicates.IRON_FURNACE), " I ", "I I", "IFI", 'I', "ingotIron", 'F', getStack(Blocks.FURNACE));
registerShaped(getStack(IC2Duplicates.EXTRACTOR), "TMT", "TCT", " ", 'T', getStack(ModItems.TREE_TAP, true), 'M', "machineBlockBasic", 'C', "circuitBasic"); registerShaped(getStack(IC2Duplicates.EXTRACTOR), "TMT", "TCT", " ", 'T', getStack(ModItems.TREE_TAP, true), 'M', "machineBlockBasic", 'C', "circuitBasic");
registerShaped(getStack(IC2Duplicates.GRINDER), "FFF", "SMS", " C ", 'F', Items.FLINT, 'S', getStack(Blocks.COBBLESTONE), 'M', "machineBlockBasic", 'C', "circuitBasic"); registerShaped(getStack(IC2Duplicates.GRINDER), "FFF", "SMS", " C ", 'F', Items.FLINT, 'S', getStack(Blocks.COBBLESTONE), 'M', getMaterial("machine", Type.MACHINE_FRAME), 'C', "circuitBasic");
registerShaped(getStack(IC2Duplicates.SOLAR_PANEL), "DLD", "LDL", "CGC", 'D', "dustCoal", 'L', "blockGlass", 'G', getStack(IC2Duplicates.GENERATOR), 'C', "circuitBasic"); registerShaped(getStack(IC2Duplicates.SOLAR_PANEL), "DLD", "LDL", "CGC", 'D', "dustCoal", 'L', "blockGlass", 'G', getStack(IC2Duplicates.GENERATOR), 'C', "circuitBasic");
registerShapeless(getStack(IC2Duplicates.FREQ_TRANSMITTER), getStack(IC2Duplicates.CABLE_ICOPPER), "circuitBasic"); registerShapeless(getStack(IC2Duplicates.FREQ_TRANSMITTER), getStack(IC2Duplicates.CABLE_ICOPPER), "circuitBasic");
} }

View file

@ -39,10 +39,12 @@ public class ItemBlockCable extends ItemBlock {
setHasSubtypes(true); setHasSubtypes(true);
} }
@Override
public int getMetadata(int damage) { public int getMetadata(int damage) {
return damage; return damage;
} }
@Override
public String getUnlocalizedName(ItemStack stack) { public String getUnlocalizedName(ItemStack stack) {
return super.getUnlocalizedName() + "." + EnumCableType.values()[stack.getItemDamage()].getName(); return super.getUnlocalizedName() + "." + EnumCableType.values()[stack.getItemDamage()].getName();
} }

View file

@ -55,6 +55,7 @@ public class ItemFrequencyTransmitter extends ItemTR {
setCreativeTab(TechRebornCreativeTabMisc.instance); setCreativeTab(TechRebornCreativeTabMisc.instance);
setMaxStackSize(1); setMaxStackSize(1);
this.addPropertyOverride(new ResourceLocation("techreborn:coords"), new IItemPropertyGetter() { this.addPropertyOverride(new ResourceLocation("techreborn:coords"), new IItemPropertyGetter() {
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public float apply(ItemStack stack, public float apply(ItemStack stack,
@Nullable @Nullable

View file

@ -182,21 +182,25 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, IEne
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -204,21 +204,25 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, IE
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -57,6 +57,7 @@ public class ItemBattery extends ItemTR implements IEnergyItemInfo, IEnergyInter
this.maxEnergy = maxEnergy; this.maxEnergy = maxEnergy;
this.maxTransfer = maxTransfer; this.maxTransfer = maxTransfer;
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter() { this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter() {
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
if (!stack.isEmpty() && PoweredItem.getEnergy(stack) == 0.0) { if (!stack.isEmpty() && PoweredItem.getEnergy(stack) == 0.0) {
@ -164,21 +165,25 @@ public class ItemBattery extends ItemTR implements IEnergyItemInfo, IEnergyInter
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -68,6 +68,7 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt
this.unpoweredSpeed = unpoweredSpeed; this.unpoweredSpeed = unpoweredSpeed;
this.addPropertyOverride(new ResourceLocation("techreborn:animated"), new IItemPropertyGetter() { this.addPropertyOverride(new ResourceLocation("techreborn:animated"), new IItemPropertyGetter() {
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public float apply(ItemStack stack, public float apply(ItemStack stack,
@Nullable @Nullable
@ -205,21 +206,25 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -209,21 +209,25 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo,
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -193,21 +193,25 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, IEnergyIn
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -190,21 +190,25 @@ public class ItemElectricTreetap extends ItemTR implements IEnergyItemInfo, IEne
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -213,21 +213,25 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, IEne
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -69,6 +69,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, IEnergy
setMaxStackSize(1); setMaxStackSize(1);
setUnlocalizedName("techreborn.nanosaber"); setUnlocalizedName("techreborn.nanosaber");
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() { this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() {
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public float apply(ItemStack stack, public float apply(ItemStack stack,
@Nullable @Nullable
@ -299,21 +300,25 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, IEnergy
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -237,21 +237,25 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, IEnerg
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -228,21 +228,25 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, IEne
} }
@Override
public double getDurabilityForDisplay(ItemStack stack) { public double getDurabilityForDisplay(ItemStack stack) {
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
return 1 - charge; return 1 - charge;
} }
@Override
public boolean showDurabilityBar(ItemStack stack) { public boolean showDurabilityBar(ItemStack stack) {
return true; return true;
} }
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) { public int getRGBDurabilityForDisplay(ItemStack stack) {
return PowerSystem.getDisplayPower().colour; return PowerSystem.getDisplayPower().colour;
} }
@Override
@Nullable @Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable @Nullable

View file

@ -38,6 +38,7 @@ public class ItemTRHoe extends ItemHoe {
TRRecipeHandler.hideEntry(this); TRRecipeHandler.hideEntry(this);
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean isFull3D() { public boolean isFull3D() {
return true; return true;

View file

@ -68,6 +68,7 @@ public class ItemWrench extends ItemTR implements IToolHandler {
return EnumActionResult.PASS; return EnumActionResult.PASS;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean isFull3D() { public boolean isFull3D() {
return true; return true;

View file

@ -29,7 +29,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.common.multiblock.CoordTriplet;
import reborncore.common.multiblock.IMultiblockPart; import reborncore.common.multiblock.IMultiblockPart;
import reborncore.common.multiblock.MultiblockControllerBase; import reborncore.common.multiblock.MultiblockControllerBase;
import reborncore.common.multiblock.MultiblockValidationException; import reborncore.common.multiblock.MultiblockValidationException;
@ -68,13 +67,13 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
throw new MultiblockValidationException("Machine is too small."); throw new MultiblockValidationException("Machine is too small.");
} }
CoordTriplet maximumCoord = getMaximumCoord(); BlockPos maximumCoord = getMaximumCoord();
CoordTriplet minimumCoord = getMinimumCoord(); BlockPos minimumCoord = getMinimumCoord();
// Quickly check for exceeded dimensions // Quickly check for exceeded dimensions
int deltaX = maximumCoord.x - minimumCoord.x + 1; int deltaX = maximumCoord.getX() - minimumCoord.getX() + 1;
int deltaY = maximumCoord.y - minimumCoord.y + 1; int deltaY = maximumCoord.getY() - minimumCoord.getY() + 1;
int deltaZ = maximumCoord.z - minimumCoord.z + 1; int deltaZ = maximumCoord.getZ() - minimumCoord.getZ() + 1;
int maxX = getMaximumXSize(); int maxX = getMaximumXSize();
int maxY = getMaximumYSize(); int maxY = getMaximumYSize();
@ -127,9 +126,9 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
RectangularMultiblockTileEntityBase part; RectangularMultiblockTileEntityBase part;
Class<? extends RectangularMultiblockControllerBase> myClass = this.getClass(); Class<? extends RectangularMultiblockControllerBase> myClass = this.getClass();
for (int x = minimumCoord.x; x <= maximumCoord.x; x++) { for (int x = minimumCoord.getX(); x <= maximumCoord.getX(); x++) {
for (int y = minimumCoord.y; y <= maximumCoord.y; y++) { for (int y = minimumCoord.getY(); y <= maximumCoord.getY(); y++) {
for (int z = minimumCoord.z; z <= maximumCoord.z; z++) { for (int z = minimumCoord.getZ(); z <= maximumCoord.getZ(); z++) {
// Okay, figure out what sort of block this should be. // Okay, figure out what sort of block this should be.
te = this.worldObj.getTileEntity(new BlockPos(x, y, z)); te = this.worldObj.getTileEntity(new BlockPos(x, y, z));
@ -152,23 +151,23 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
// Validate block type against both part-level and // Validate block type against both part-level and
// material-level validators. // material-level validators.
int extremes = 0; int extremes = 0;
if (x == minimumCoord.x) { if (x == minimumCoord.getX()) {
extremes++; extremes++;
} }
if (y == minimumCoord.y) { if (y == minimumCoord.getY()) {
extremes++; extremes++;
} }
if (z == minimumCoord.z) { if (z == minimumCoord.getZ()) {
extremes++; extremes++;
} }
if (x == maximumCoord.x) { if (x == maximumCoord.getX()) {
extremes++; extremes++;
} }
if (y == maximumCoord.y) { if (y == maximumCoord.getY()) {
extremes++; extremes++;
} }
if (z == maximumCoord.z) { if (z == maximumCoord.getZ()) {
extremes++; extremes++;
} }
@ -179,13 +178,13 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
isBlockGoodForFrame(this.worldObj, x, y, z); isBlockGoodForFrame(this.worldObj, x, y, z);
} }
} else if (extremes == 1) { } else if (extremes == 1) {
if (y == maximumCoord.y) { if (y == maximumCoord.getY()) {
if (part != null) { if (part != null) {
part.isGoodForTop(); part.isGoodForTop();
} else { } else {
isBlockGoodForTop(this.worldObj, x, y, z); isBlockGoodForTop(this.worldObj, x, y, z);
} }
} else if (y == minimumCoord.y) { } else if (y == minimumCoord.getY()) {
if (part != null) { if (part != null) {
part.isGoodForBottom(); part.isGoodForBottom();
} else { } else {

View file

@ -24,19 +24,10 @@
package techreborn.proxies; package techreborn.proxies;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
import net.minecraft.client.renderer.block.statemap.StateMap; import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
@ -59,6 +50,7 @@ import techreborn.client.keybindings.KeyBindings;
import techreborn.client.render.ModelDynamicCell; import techreborn.client.render.ModelDynamicCell;
import techreborn.client.render.entitys.RenderNukePrimed; import techreborn.client.render.entitys.RenderNukePrimed;
import techreborn.entities.EntityNukePrimed; import techreborn.entities.EntityNukePrimed;
import techreborn.events.FluidBlockModelHandler;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.items.ItemFrequencyTransmitter; import techreborn.items.ItemFrequencyTransmitter;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
@ -67,26 +59,6 @@ public class ClientProxy extends CommonProxy {
public static MultiblockRenderEvent multiblockRenderEvent; public static MultiblockRenderEvent multiblockRenderEvent;
public static ResourceLocation getItemLocation(Item item) {
Object o = item.getRegistryName();
if (o == null) {
return null;
}
return (ResourceLocation) o;
}
private static ResourceLocation registerIt(Item item, final ResourceLocation location) {
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(location, "inventory");
}
});
ModelLoader.registerItemVariants(item, location);
return location;
}
@Override @Override
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLPreInitializationEvent event) {
super.preInit(event); super.preInit(event);
@ -96,12 +68,7 @@ public class ClientProxy extends CommonProxy {
ModelDynamicCell.init(); ModelDynamicCell.init();
RegisterItemJsons.registerModels(); RegisterItemJsons.registerModels();
MinecraftForge.EVENT_BUS.register(new IconSupplier()); MinecraftForge.EVENT_BUS.register(new IconSupplier());
} MinecraftForge.EVENT_BUS.register(new FluidBlockModelHandler());
@Override
public void registerSubItemInventoryLocation(Item item, int meta, String location, String name) {
ModelResourceLocation resourceLocation = new ModelResourceLocation(location, name);
ModelLoader.setCustomModelResourceLocation(item, meta, resourceLocation);
} }
@Override @Override
@ -117,74 +84,6 @@ public class ClientProxy extends CommonProxy {
ModelLoader.setCustomStateMapper(ModBlocks.RUBBER_LEAVES, rubberLeavesStateMap); ModelLoader.setCustomStateMapper(ModBlocks.RUBBER_LEAVES, rubberLeavesStateMap);
} }
protected void registerItemModel(ItemStack item, String name) {
// tell Minecraft which textures it has to load. This is resource-domain sensitive
ModelLoader.registerItemVariants(item.getItem(), new ResourceLocation(name));
// tell the game which model to use for this item-meta combination
ModelLoader.setCustomModelResourceLocation(item.getItem(), item
.getMetadata(), new ModelResourceLocation(name, "inventory"));
}
public ResourceLocation registerItemModel(Item item) {
ResourceLocation itemLocation = getItemLocation(item);
if (itemLocation == null) {
return null;
}
return registerIt(item, itemLocation);
}
@Override
public void registerFluidBlockRendering(Block block, String name) {
name = name.toLowerCase();
super.registerFluidBlockRendering(block, name);
final ModelResourceLocation fluidLocation = new ModelResourceLocation(ModInfo.MOD_ID.toLowerCase() + ":fluids", name);
// use a custom state mapper which will ignore the LEVEL property
ModelLoader.setCustomStateMapper(block, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return fluidLocation;
}
});
}
@Override
public void registerCustomBlockStateLocation(Block block, String resourceLocation) {
resourceLocation = resourceLocation.toLowerCase();
super.registerCustomBlockStateLocation(block, resourceLocation);
String finalResourceLocation = resourceLocation;
ModelLoader.setCustomStateMapper(block, new DefaultStateMapper() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
String resourceDomain = Block.REGISTRY.getNameForObject(state.getBlock()).getResourceDomain();
String propertyString = getPropertyString(state.getProperties());
return new ModelResourceLocation(resourceDomain + ':' + finalResourceLocation, propertyString);
}
});
String resourceDomain = Block.REGISTRY.getNameForObject(block).getResourceDomain();
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(resourceDomain + ':' + resourceLocation, "inventory"));
}
@Override
public void registerCustomBlockStateLocation(Block block, String resourceLocation, boolean item) {
resourceLocation = resourceLocation.toLowerCase();
super.registerCustomBlockStateLocation(block, resourceLocation, item);
String finalResourceLocation = resourceLocation;
ModelLoader.setCustomStateMapper(block, new DefaultStateMapper() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
String resourceDomain = Block.REGISTRY.getNameForObject(state.getBlock()).getResourceDomain();
String propertyString = getPropertyString(state.getProperties());
return new ModelResourceLocation(resourceDomain + ':' + finalResourceLocation, propertyString);
}
});
if (item) {
String resourceDomain = Block.REGISTRY.getNameForObject(block).getResourceDomain();
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(resourceDomain + ':' + resourceLocation, "inventory"));
}
}
@Override @Override
public boolean isCTMAvailable() { public boolean isCTMAvailable() {
return isChiselAround; return isChiselAround;

View file

@ -24,9 +24,6 @@
package techreborn.proxies; package techreborn.proxies;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@ -39,7 +36,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");
} }
@ -60,26 +56,6 @@ public class CommonProxy implements ICompatModule {
} }
public void registerFluidBlockRendering(Block block, String name) {
}
public void registerCustomBlockStateLocation(Block block, String name) {
}
public void registerCustomBlockStateLocation(Block block, String name, boolean item) {
}
public void registerSubItemInventoryLocation(Item item, int meta, String location, String name) {
}
public void registerSubBlockInventoryLocation(Block block, int meta, String location, String name) {
registerSubItemInventoryLocation(Item.getItemFromBlock(block), meta, location, name);
}
public boolean isCTMAvailable() { public boolean isCTMAvailable() {
return false; return false;
} }

View file

@ -226,41 +226,44 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
} }
public boolean make(IRecipe recipe) { public boolean make(IRecipe recipe) {
if (canMake(recipe)) { IRecipe recipe2 = recipe;
if (recipe == null && customRecipe) { if (canMake(recipe2)) {
if (recipe2 == null && customRecipe) {
if (lastCustomRecipe == null) { if (lastCustomRecipe == null) {
return false; return false;
}//Should be uptodate as we just set it in canMake }//Should be uptodate as we just set it in canMake
recipe = lastCustomRecipe; recipe = lastCustomRecipe;
} }
for (int i = 0; i < recipe.getIngredients().size(); i++) { else if (recipe2 != null) {
Ingredient ingredient = recipe.getIngredients().get(i); for (int i = 0; i < recipe2.getIngredients().size(); i++) {
//Looks for the best slot to take it from Ingredient ingredient = recipe2.getIngredients().get(i);
ItemStack bestSlot = inventory.getStackInSlot(i); //Looks for the best slot to take it from
if (ingredient.apply(bestSlot)) { ItemStack bestSlot = inventory.getStackInSlot(i);
handleContainerItem(bestSlot); if (ingredient.apply(bestSlot)) {
bestSlot.shrink(1); handleContainerItem(bestSlot);
} else { bestSlot.shrink(1);
for (int j = 0; j < 9; j++) { } else {
ItemStack stack = inventory.getStackInSlot(j); for (int j = 0; j < 9; j++) {
if (ingredient.apply(stack)) { ItemStack stack = inventory.getStackInSlot(j);
handleContainerItem(stack); if (ingredient.apply(stack)) {
stack.shrink(1); //TODO is this right? or do I need to use it as an actull crafting grid handleContainerItem(stack);
break; stack.shrink(1); //TODO is this right? or do I need to use it as an actull crafting grid
break;
}
} }
} }
} }
ItemStack output = inventory.getStackInSlot(9);
//TODO fire forge recipe event
ItemStack ouputStack = recipe2.getCraftingResult(getCraftingInventory());
if (output.isEmpty()) {
inventory.setInventorySlotContents(9, ouputStack.copy());
} else {
//TODO use ouputStack in someway?
output.grow(recipe2.getRecipeOutput().getCount());
}
return true;
} }
ItemStack output = inventory.getStackInSlot(9);
//TODO fire forge recipe event
ItemStack ouputStack = recipe.getCraftingResult(getCraftingInventory());
if (output.isEmpty()) {
inventory.setInventorySlotContents(9, ouputStack.copy());
} else {
//TODO use ouputStack in someway?
output.grow(recipe.getRecipeOutput().getCount());
}
return true;
} }
return false; return false;
} }

View file

@ -72,6 +72,8 @@ public class TileIronAlloyFurnace extends TileLegacyMachineBase
/** /**
* Returns the number of ticks that the supplied fuel item will keep the * Returns the number of ticks that the supplied fuel item will keep the
* furnace burning, or 0 if the item isn't fuel * furnace burning, or 0 if the item isn't fuel
* @param stack Itemstack of fuel
* @return Integer Number of ticks
*/ */
public static int getItemBurnTime(ItemStack stack) { public static int getItemBurnTime(ItemStack stack) {
if (stack.isEmpty()) { if (stack.isEmpty()) {
@ -273,6 +275,7 @@ public class TileIronAlloyFurnace extends TileLegacyMachineBase
/** /**
* Furnace isBurning * Furnace isBurning
* @return Boolean True if furnace is burning
*/ */
public boolean isBurning() { public boolean isBurning() {
return this.burnTime > 0; return this.burnTime > 0;

View file

@ -235,9 +235,9 @@ public class TileIronFurnace extends TileLegacyMachineBase
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("ironfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142) return new ContainerBuilder("ironfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 56, 17).outputSlot(1, 116, 35).fuelSlot(2, 56, 53) .addInventory().tile(this).fuelSlot(2, 56, 53).slot(0, 56, 17).outputSlot(1, 116, 35)
.syncIntegerValue(this::getBurnTime, this::setBurnTime) .syncIntegerValue(this::getBurnTime, this::setBurnTime)
.syncIntegerValue(this::getProgress, this::setProgress) .syncIntegerValue(this::getProgress, this::setProgress)
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create(this); .syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create(this);
} }
} }

View file

@ -76,6 +76,7 @@ public class TileMachineCasing extends RectangularMultiblockTileEntityBase {
} }
@Override
public MultiBlockCasing getMultiblockController() { public MultiBlockCasing getMultiblockController() {
return (MultiBlockCasing) super.getMultiblockController(); return (MultiBlockCasing) super.getMultiblockController();
} }

View file

@ -143,6 +143,7 @@ public class TilePump extends TilePowerAcceptor {
readFromNBTWithoutCoords(tagCompound); readFromNBTWithoutCoords(tagCompound);
} }
@Override
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound) { public void readFromNBTWithoutCoords(NBTTagCompound tagCompound) {
tank.readFromNBT(tagCompound); tank.readFromNBT(tagCompound);
} }
@ -154,6 +155,7 @@ public class TilePump extends TilePowerAcceptor {
return tagCompound; return tagCompound;
} }
@Override
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) { public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
tank.writeToNBT(tagCompound); tank.writeToNBT(tagCompound);
return tagCompound; return tagCompound;

View file

@ -114,7 +114,7 @@ public class TileRollingMachine extends TilePowerAcceptor
boolean hasCrafted = false; boolean hasCrafted = false;
if (this.inventory.getStackInSlot(outputSlot) == ItemStack.EMPTY) { if (this.inventory.getStackInSlot(outputSlot) == ItemStack.EMPTY) {
this.inventory.setInventorySlotContents(outputSlot, this.currentRecipe); this.inventory.setInventorySlotContents(outputSlot, this.currentRecipe);
this.tickTime = -1; this.tickTime = 0;
hasCrafted = true; hasCrafted = true;
} else { } else {
if (this.inventory.getStackInSlot(outputSlot).getCount() + this.currentRecipe.getCount() <= this.currentRecipe if (this.inventory.getStackInSlot(outputSlot).getCount() + this.currentRecipe.getCount() <= this.currentRecipe
@ -122,7 +122,7 @@ public class TileRollingMachine extends TilePowerAcceptor
final ItemStack stack = this.inventory.getStackInSlot(outputSlot); final ItemStack stack = this.inventory.getStackInSlot(outputSlot);
stack.setCount(stack.getCount() + this.currentRecipe.getCount()); stack.setCount(stack.getCount() + this.currentRecipe.getCount());
this.inventory.setInventorySlotContents(outputSlot, stack); this.inventory.setInventorySlotContents(outputSlot, stack);
this.tickTime = -1; this.tickTime = 0;
hasCrafted = true; hasCrafted = true;
} }
} }
@ -136,13 +136,13 @@ public class TileRollingMachine extends TilePowerAcceptor
} }
} }
if (!this.currentRecipe.isEmpty()) { if (!this.currentRecipe.isEmpty()) {
if (this.canUseEnergy(energyPerTick) && this.tickTime < TileRollingMachine.runTime) { if (this.canUseEnergy(energyPerTick) && this.tickTime < TileRollingMachine.runTime && canMake()) {
this.useEnergy(energyPerTick); this.useEnergy(energyPerTick);
this.tickTime++; this.tickTime++;
} }
} }
if (this.currentRecipe.isEmpty()) { if (this.currentRecipe.isEmpty()) {
this.tickTime = -1; this.tickTime = 0;
} }
} else { } else {
this.currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world); this.currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world);
@ -155,7 +155,15 @@ public class TileRollingMachine extends TilePowerAcceptor
} }
public boolean canMake() { public boolean canMake() {
return RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world) != null; ItemStack stack = RollingMachineRecipe.instance.findMatchingRecipe(this.craftMatrix, this.world);
if(stack.isEmpty()){
return false;
}
ItemStack output = getStackInSlot(outputSlot);
if(output.isEmpty()){
return true;
}
return ItemUtils.isItemEqual(stack, output, true, true);
} }
@Override @Override

View file

@ -170,6 +170,11 @@ public class TileFusionControlComputer extends TilePowerAcceptor implements IToo
return this.world.getBlockState(new BlockPos(x, y, z)).getBlock() == ModBlocks.FUSION_COIL; return this.world.getBlockState(new BlockPos(x, y, z)).getBlock() == ModBlocks.FUSION_COIL;
} }
@Override
public void onLoad() {
this.checkCoils();
}
@Override @Override
public void update() { public void update() {
super.update(); super.update();

View file

@ -92,11 +92,13 @@ public class TileInterdimensionalSU extends TileEnergyStorage implements IContai
return input <= IDSUManager.getData(world).getStoredPower(); return input <= IDSUManager.getData(world).getStoredPower();
} }
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) { public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound); super.readFromNBT(nbttagcompound);
this.ownerUdid = nbttagcompound.getString("ownerUdid"); this.ownerUdid = nbttagcompound.getString("ownerUdid");
} }
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound); super.writeToNBT(nbttagcompound);
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) { if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {

View file

@ -29,6 +29,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.api.power.EnumPowerTier; import reborncore.api.power.EnumPowerTier;
import reborncore.common.RebornCoreConfig;
import reborncore.common.registration.RebornRegistry; import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.blocks.storage.BlockLapotronicSU; import techreborn.blocks.storage.BlockLapotronicSU;
@ -89,7 +90,7 @@ public class TileLapotronicSU extends TileEnergyStorage implements IContainerPro
} }
} }
} }
this.maxStorage = ((connectedBlocks + 1) * storagePerBlock); setMaxStorage();
this.maxOutput = (connectedBlocks * extraIOPerBlock) + baseOutput; this.maxOutput = (connectedBlocks * extraIOPerBlock) + baseOutput;
} }
@ -110,12 +111,22 @@ public class TileLapotronicSU extends TileEnergyStorage implements IContainerPro
this.maxOutput = output; this.maxOutput = output;
} }
public int getMaxStorage() { public int getConnectedBlocksNum() {
return this.maxStorage; return this.connectedBlocks;
} }
public void setMaxStorage(int value) { public void setConnectedBlocksNum(int value) {
this.maxStorage = value; this.connectedBlocks = value;
if (world.isRemote) {
setMaxStorage();
}
}
public void setMaxStorage(){
this.maxStorage = (this.connectedBlocks + 1) * storagePerBlock;
if (this.maxStorage < 0 || this.maxStorage > Integer.MAX_VALUE / RebornCoreConfig.euPerFU) {
this.maxStorage = Integer.MAX_VALUE / RebornCoreConfig.euPerFU;
}
} }
@Override @Override
@ -123,6 +134,6 @@ public class TileLapotronicSU extends TileEnergyStorage implements IContainerPro
return new ContainerBuilder("lesu").player(player.inventory).inventory().hotbar().armor().complete(8, 18) return new ContainerBuilder("lesu").player(player.inventory).inventory().hotbar().armor().complete(8, 18)
.addArmor().addInventory().tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue() .addArmor().addInventory().tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue()
.syncIntegerValue(this::getOutputRate, this::setOutputRate) .syncIntegerValue(this::getOutputRate, this::setOutputRate)
.syncIntegerValue(this::getMaxStorage, this::setMaxStorage).addInventory().create(this); .syncIntegerValue(this::getConnectedBlocksNum, this::setConnectedBlocksNum).addInventory().create(this);
} }
} }

View file

@ -37,6 +37,7 @@ import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.IInventoryProvider; import reborncore.api.tile.IInventoryProvider;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.registration.impl.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.Inventory;
import techreborn.api.Reference; import techreborn.api.Reference;
@ -44,7 +45,9 @@ import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder; import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileDistillationTower extends TilePowerAcceptor public class TileDistillationTower extends TilePowerAcceptor
implements IToolDrop, IRecipeCrafterProvider, IInventoryProvider, IContainerProvider { implements IToolDrop, IRecipeCrafterProvider, IInventoryProvider, IContainerProvider {

View file

@ -34,16 +34,25 @@ import reborncore.api.tile.IInventoryProvider;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.Inventory;
import techreborn.api.Reference; import techreborn.api.Reference;
import techreborn.client.container.IContainerProvider; import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder; import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileImplosionCompressor extends TilePowerAcceptor public class TileImplosionCompressor extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
@ConfigRegistry(config = "machines", category = "implosion_compressor", key = "ImplosionCompressorMaxInput", comment = "Implosion Compressor Max Input (Value in EU)")
public static int maxInput = 64;
@ConfigRegistry(config = "machines", category = "implosion_compressor", key = "ImplosionCompressorMaxEnergy", comment = "Implosion Compressor Max Energy (Value in EU)")
public static int maxEnergy = 64000;
public Inventory inventory = new Inventory(5, "TileImplosionCompressor", 64, this); public Inventory inventory = new Inventory(5, "TileImplosionCompressor", 64, this);
public MultiblockChecker multiblockChecker; public MultiblockChecker multiblockChecker;
public RecipeCrafter crafter; public RecipeCrafter crafter;
@ -119,7 +128,7 @@ public class TileImplosionCompressor extends TilePowerAcceptor
@Override @Override
public double getBaseMaxPower() { public double getBaseMaxPower() {
return 64000; return maxEnergy;
} }
@Override @Override
@ -139,7 +148,7 @@ public class TileImplosionCompressor extends TilePowerAcceptor
@Override @Override
public double getBaseMaxInput() { public double getBaseMaxInput() {
return 64; return maxInput;
} }
@Override @Override

View file

@ -40,6 +40,8 @@ import reborncore.api.IToolDrop;
import reborncore.common.multiblock.IMultiblockPart; import reborncore.common.multiblock.IMultiblockPart;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.Inventory;
import techreborn.api.Reference; import techreborn.api.Reference;
import techreborn.api.recipe.ITileRecipeHandler; import techreborn.api.recipe.ITileRecipeHandler;
@ -49,12 +51,19 @@ import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder; import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
import techreborn.multiblocks.MultiBlockCasing; import techreborn.multiblocks.MultiBlockCasing;
import techreborn.tiles.TileMachineCasing; import techreborn.tiles.TileMachineCasing;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements IToolDrop, IInventoryProvider, public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements IToolDrop, IInventoryProvider,
ITileRecipeHandler<BlastFurnaceRecipe>, IRecipeCrafterProvider, IContainerProvider { ITileRecipeHandler<BlastFurnaceRecipe>, IRecipeCrafterProvider, IContainerProvider {
@ConfigRegistry(config = "machines", category = "industrial_furnace", key = "IndustrialFurnaceMaxInput", comment = "Industrial Blast Furnace Max Input (Value in EU)")
public static int maxInput = 128;
@ConfigRegistry(config = "machines", category = "industrial_furnace", key = "IndustrialFurnaceMaxEnergy", comment = "Industrial Blast Furnace Max Energy (Value in EU)")
public static int maxEnergy = 10000;
public Inventory inventory; public Inventory inventory;
public RecipeCrafter crafter; public RecipeCrafter crafter;
public MultiblockChecker multiblockChecker; public MultiblockChecker multiblockChecker;
@ -62,14 +71,9 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
public TileIndustrialBlastFurnace() { public TileIndustrialBlastFurnace() {
super(); super();
// TODO configs
this.inventory = new Inventory(5, "TileIndustrialBlastFurnace", 64, this); this.inventory = new Inventory(5, "TileIndustrialBlastFurnace", 64, this);
final int[] inputs = new int[2]; final int[] inputs = new int[] { 0, 1 };
inputs[0] = 0; final int[] outputs = new int[] { 2, 3 };
inputs[1] = 1;
final int[] outputs = new int[2];
outputs[0] = 2;
outputs[1] = 3;
this.crafter = new RecipeCrafter(Reference.blastFurnaceRecipe, this, 2, 2, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(Reference.blastFurnaceRecipe, this, 2, 2, this.inventory, inputs, outputs);
} }
@ -194,7 +198,7 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
@Override @Override
public double getBaseMaxPower() { public double getBaseMaxPower() {
return 10000; return maxEnergy;
} }
@Override @Override
@ -214,7 +218,7 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
@Override @Override
public double getBaseMaxInput() { public double getBaseMaxInput() {
return 128; return maxInput;
} }
@Override @Override

View file

@ -40,6 +40,8 @@ import reborncore.api.tile.IInventoryProvider;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import reborncore.common.util.FluidUtils; import reborncore.common.util.FluidUtils;
import reborncore.common.util.Inventory; import reborncore.common.util.Inventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
@ -50,11 +52,18 @@ import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder; import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDrop, IInventoryProvider, public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDrop, IInventoryProvider,
ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerProvider { ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerProvider {
public static final int TANK_CAPACITY = 16000;
@ConfigRegistry(config = "machines", category = "industrial_grinder", key = "IndustrialGrinderMaxInput", comment = "Industrial Grinder Max Input (Value in EU)")
public static int maxInput = 128;
@ConfigRegistry(config = "machines", category = "industrial_grinder", key = "IndustrialGrinderMaxEnergy", comment = "Industrial Grinder Max Energy (Value in EU)")
public static int maxEnergy = 10000;
public static final int TANK_CAPACITY = 16000;
public Inventory inventory; public Inventory inventory;
public Tank tank; public Tank tank;
public RecipeCrafter crafter; public RecipeCrafter crafter;
@ -63,19 +72,11 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
public TileIndustrialGrinder() { public TileIndustrialGrinder() {
super(); super();
// TODO configs this.tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this);
this.inventory = new Inventory(8, "TileIndustrialGrinder", 64, this);
tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this); this.ticksSinceLastChange = 0;
inventory = new Inventory(8, "TileIndustrialGrinder", 64, this); final int[] inputs = new int[] { 0, 1 };
ticksSinceLastChange = 0; final int[] outputs = new int[] {2, 3, 4, 5};
final int[] inputs = new int[2];
inputs[0] = 0;
inputs[1] = 1;
final int[] outputs = new int[4];
outputs[0] = 2;
outputs[1] = 3;
outputs[2] = 4;
outputs[3] = 5;
this.crafter = new RecipeCrafter(Reference.industrialGrinderRecipe, this, 1, 4, this.inventory, inputs, this.crafter = new RecipeCrafter(Reference.industrialGrinderRecipe, this, 1, 4, this.inventory, inputs,
outputs); outputs);
} }
@ -192,7 +193,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
@Override @Override
public double getBaseMaxPower() { public double getBaseMaxPower() {
return 10000; return maxEnergy;
} }
@Override @Override
@ -212,7 +213,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
@Override @Override
public double getBaseMaxInput() { public double getBaseMaxInput() {
return 64; return maxInput;
} }
@Override @Override

View file

@ -69,14 +69,13 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IToolDrop, I
super.update(); super.update();
if (!inventory.getStackInSlot(0).isEmpty()) { if (!inventory.getStackInSlot(0).isEmpty()) {
ItemStack stack = inventory.getStackInSlot(0); ItemStack stack = inventory.getStackInSlot(0);
if (!(stack.getItem() instanceof IEnergyItemInfo)) { if (stack.getItem() instanceof IEnergyItemInfo) {
return; IEnergyItemInfo item = (IEnergyItemInfo) inventory.getStackInSlot(0).getItem();
} if (PoweredItem.getEnergy(stack) != PoweredItem.getMaxPower(stack)) {
IEnergyItemInfo item = (IEnergyItemInfo) inventory.getStackInSlot(0).getItem(); if (canUseEnergy(item.getMaxTransfer(stack))) {
if (PoweredItem.getEnergy(stack) != PoweredItem.getMaxPower(stack)) { useEnergy(item.getMaxTransfer(stack));
if (canUseEnergy(item.getMaxTransfer(stack))) { PoweredItem.setEnergy(PoweredItem.getEnergy(stack) + item.getMaxTransfer(stack), stack);
useEnergy(item.getMaxTransfer(stack)); }
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) + item.getMaxTransfer(stack), stack);
} }
} }
if(CompatManager.isIC2Loaded){ if(CompatManager.isIC2Loaded){

View file

@ -34,16 +34,23 @@ import reborncore.api.IListInfoProvider;
import reborncore.api.power.EnumPowerTier; import reborncore.api.power.EnumPowerTier;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import reborncore.common.util.StringUtils; import reborncore.common.util.StringUtils;
import techreborn.blocks.transformers.BlockTransformer; import techreborn.blocks.transformers.BlockTransformer;
import techreborn.lib.ModInfo;
import java.util.List; import java.util.List;
/** /**
* Created by Rushmead * Created by Rushmead
*/ */
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileTransformer extends TilePowerAcceptor implements IToolDrop, ITickable, IListInfoProvider { public class TileTransformer extends TilePowerAcceptor implements IToolDrop, ITickable, IListInfoProvider {
@ConfigRegistry(config = "misc", category = "general", key = "IC2TransformersStyle", comment = "Input from dots side, output from other sides, like in IC2.")
public static boolean IC2TransformersStyle = false;
public String name; public String name;
public Block wrenchDrop; public Block wrenchDrop;
public EnumPowerTier inputTier; public EnumPowerTier inputTier;
@ -79,7 +86,9 @@ public class TileTransformer extends TilePowerAcceptor implements IToolDrop, ITi
@Override @Override
public boolean canAcceptEnergy(EnumFacing direction) { public boolean canAcceptEnergy(EnumFacing direction) {
if (IC2TransformersStyle == true){
return getFacingEnum() == direction;
}
return getFacingEnum() != direction; return getFacingEnum() != direction;
} }
@ -94,6 +103,9 @@ public class TileTransformer extends TilePowerAcceptor implements IToolDrop, ITi
@Override @Override
public boolean canProvideEnergy(EnumFacing direction) { public boolean canProvideEnergy(EnumFacing direction) {
if (IC2TransformersStyle == true){
return getFacingEnum() != direction;
}
return getFacing() == direction; return getFacing() == direction;
} }

View file

@ -40,4 +40,11 @@ public class IC2ItemCharger {
} }
} }
public static boolean isIC2PoweredItem(ItemStack stack){
if(stack.isEmpty()){
return false;
}
return stack.getItem() instanceof IElectricItem;
}
} }

View file

@ -218,21 +218,27 @@ public class TechRebornWorldGen implements IWorldGenerator {
yPos = ore.minYHeight + random.nextInt(ore.maxYHeight - ore.minYHeight); yPos = ore.minYHeight + random.nextInt(ore.maxYHeight - ore.minYHeight);
zPos = chunkZ * 16 + random.nextInt(16); zPos = chunkZ * 16 + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos); BlockPos pos = new BlockPos(xPos, yPos, zPos);
if (ore.blockNiceName.equalsIgnoreCase("iridium")) { //Work around for iridium
BlockPos iridiumPos = pos.add(8, 0, 8); // standard worldgen offset is added here like in WorldGenMinable#generate
IBlockState blockState = world.getBlockState(iridiumPos);
if (blockState.getBlock().isReplaceableOreGen(blockState, world, iridiumPos, predicate)) {
world.setBlockState(iridiumPos, ore.state, 2);
}
if (ore.veinSize < 4){
// Workaround for small veins
for (int j = 1; j < ore.veinSize; j++) {
// standard worldgen offset is added here like in WorldGenMinable#generate
BlockPos smallVeinPos = pos.add(8, 0, 8);
smallVeinPos.add(random.nextInt(2), random.nextInt(2), random.nextInt(2));
IBlockState blockState = world.getBlockState(smallVeinPos);
if (blockState.getBlock().isReplaceableOreGen(blockState, world, smallVeinPos, predicate)) {
world.setBlockState(smallVeinPos, ore.state, 2);
}
}
} else { } else {
try { try {
worldGenMinable.generate(world, random, pos); worldGenMinable.generate(world, random, pos);
} catch (ArrayIndexOutOfBoundsException e) { } catch (ArrayIndexOutOfBoundsException e) {
Core.logHelper.error("Something bad is happening during world gen the ore " + ore.blockNiceName + " caused a crash when generating. Report this to the TechReborn devs with a log"); Core.logHelper.error("Something bad is happening during world gen the ore "
+ ore.blockNiceName
+ " caused a crash when generating. Report this to the TechReborn devs with a log");
} }
} }
} }
} }
} }
@ -242,8 +248,7 @@ public class TechRebornWorldGen implements IWorldGenerator {
boolean isValidSpawn = false; boolean isValidSpawn = false;
Biome biomeGenBase = world.getBiomeForCoordsBody(new BlockPos(chunkX * 16, 72, chunkZ * 16)); Biome biomeGenBase = world.getBiomeForCoordsBody(new BlockPos(chunkX * 16, 72, chunkZ * 16));
if (BiomeDictionary.hasType(biomeGenBase, BiomeDictionary.Type.SWAMP)) { if (BiomeDictionary.hasType(biomeGenBase, BiomeDictionary.Type.SWAMP)) {
// TODO check the config file for bounds on this, might cause // TODO check the config file for bounds on this, might cause issues
// issues
chance -= random.nextInt(10) + 10; chance -= random.nextInt(10) + 10;
isValidSpawn = true; isValidSpawn = true;
} }

View file

@ -1,12 +1,12 @@
{ {
"forge_marker": 1, "forge_marker": 1,
"variants": { "defaults": {
"techreborn.berylium": { "model": "forge:fluid"
"model": "forge:fluid", },
"custom": { "variants": {
"fluid": "fluidberylium" "techreborn.berylium": [{
} "custom": { "fluid": "fluidberylium" }
}, }],
"techreborn.calcium": { "techreborn.calcium": {
"model": "forge:fluid", "model": "forge:fluid",
"custom": { "custom": {

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
{
"parent": "techreborn:item/techrebornItem",
"textures": {
"layer0": "techreborn:items/misc/missing_recipe"
}
}

View file

@ -0,0 +1,9 @@
{
"ctm":{
"ctm_version": 1,
"type":"CTM",
"textures":[
"techreborn:blocks/machines/energy/ev_multi_side_ctm"
]
}
}