Merge pull request #1348 from TechReborn/feature/solar-panles
Feature/solar panles
|
@ -87,7 +87,7 @@ if (ENV.BUILD_NUMBER) {
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.12.2-14.23.0.2552"
|
version = "1.12.2-14.23.1.2555"
|
||||||
mappings = "snapshot_20171003"
|
mappings = "snapshot_20171003"
|
||||||
replace "@MODVERSION@", project.version
|
replace "@MODVERSION@", project.version
|
||||||
useDepAts = true
|
useDepAts = true
|
||||||
|
@ -120,8 +120,8 @@ dependencies {
|
||||||
deobfCompile "mcjty.theoneprobe:TheOneProbe-1.12:1.12-1.4.18-10"
|
deobfCompile "mcjty.theoneprobe:TheOneProbe-1.12:1.12-1.4.18-10"
|
||||||
compile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.0.7.273", withoutOldJEI
|
compile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.0.7.273", withoutOldJEI
|
||||||
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-2.3.7.14:universal'
|
||||||
deobfCompile 'cofh:ThermalExpansion:1.12-5.3.5.19:universal', withoutOldJEI
|
deobfCompile 'cofh:ThermalExpansion:1.12.2-5.3.7.26:universal'
|
||||||
|
|
||||||
compile name: 'buildcraft', version: '7.99.12', ext: 'jar'
|
compile name: 'buildcraft', version: '7.99.12', ext: 'jar'
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* 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.solarpanel;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
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 final String[] panes = new String[] {
|
||||||
|
"basic", "hybrid", "advanced", "ultimate", "quantum"};
|
||||||
|
public static PropertyBool ACTIVE = PropertyBool.create("active");
|
||||||
|
public static final IProperty<EnumPanelType> TYPE = PropertyEnum.create("type", EnumPanelType.class);
|
||||||
|
|
||||||
|
public BlockSolarPanel() {
|
||||||
|
super(Material.IRON);
|
||||||
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
|
this.setDefaultState(this.getBlockState().getBaseState().withProperty(ACTIVE, false).withProperty(TYPE, EnumPanelType.Basic));
|
||||||
|
setHardness(2.0F);
|
||||||
|
//this.setDefaultState(this.getStateFromMeta(0));
|
||||||
|
for (int i = 0; i < panes.length; i++) {
|
||||||
|
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/generators").setInvVariant("active=false,type=" + panes[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state) {
|
||||||
|
int active = state.getValue(ACTIVE) ? EnumPanelType.values().length : 0;
|
||||||
|
return state.getValue(TYPE).ordinal() + active;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockStateContainer createBlockState() {
|
||||||
|
return new BlockStateContainer(this, ACTIVE, TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
|
boolean active = false;
|
||||||
|
if(meta >= EnumPanelType.values().length){
|
||||||
|
active = true;
|
||||||
|
meta -= EnumPanelType.values().length;
|
||||||
|
}
|
||||||
|
return getDefaultState().withProperty(ACTIVE, active).withProperty(TYPE, EnumPanelType.values()[meta]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||||
|
return new TileSolarPanel(getStateFromMeta(meta).getValue(TYPE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||||
|
return getStateFromMeta(placer.getHeldItem(hand).getItemDamage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
|
//return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(world.getBlockState(pos)));
|
||||||
|
return new ItemStack(Item.getItemFromBlock(this), 1, world.getBlockState(pos).getValue(TYPE).ordinal());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int damageDropped(IBlockState state) {
|
||||||
|
return getMetaFromState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||||
|
for (EnumPanelType panelType : EnumPanelType.values()) {
|
||||||
|
list.add(new ItemStack(this, 1, panelType.ordinal()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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.solarpanel;
|
||||||
|
|
||||||
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
import reborncore.api.power.EnumPowerTier;
|
||||||
|
|
||||||
|
public enum EnumPanelType implements IStringSerializable {
|
||||||
|
Basic("basic", 1, 0, EnumPowerTier.MICRO),
|
||||||
|
Hybrid("hybrid", 16, 0, EnumPowerTier.LOW),
|
||||||
|
Advanced("advanced", 64, 2, EnumPowerTier.MEDIUM),
|
||||||
|
Ultimate("ultimate", 256, 16, EnumPowerTier.HIGH),
|
||||||
|
Quantum("quantum", 1024, 64, EnumPowerTier.EXTREME);
|
||||||
|
|
||||||
|
private String friendlyName;
|
||||||
|
// Generation of EU during Day
|
||||||
|
public int generationRateD = 10;
|
||||||
|
// Generation of EU during Night
|
||||||
|
public int generationRateN = 0;
|
||||||
|
// Internal EU storage of solar panel
|
||||||
|
public int internalCapacity = 1000;
|
||||||
|
public EnumPowerTier powerTier;
|
||||||
|
|
||||||
|
|
||||||
|
EnumPanelType(String friendlyName, int generationRateD, int generationRateN, EnumPowerTier tier) {
|
||||||
|
this.friendlyName = friendlyName;
|
||||||
|
this.generationRateD = generationRateD;
|
||||||
|
this.generationRateN = generationRateN;
|
||||||
|
this.internalCapacity = (generationRateD * 1000);
|
||||||
|
this.powerTier = tier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return friendlyName;
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,7 +70,7 @@ public class StackToolTipEvent {
|
||||||
if (block != null && (block instanceof BlockContainer || block instanceof ITileEntityProvider)
|
if (block != null && (block instanceof BlockContainer || block instanceof ITileEntityProvider)
|
||||||
&& block.getRegistryName().getResourceDomain().contains("techreborn")) {
|
&& block.getRegistryName().getResourceDomain().contains("techreborn")) {
|
||||||
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().world,
|
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().world,
|
||||||
block.getDefaultState());
|
block.getStateFromMeta(event.getItemStack().getItemDamage()));
|
||||||
if (tile instanceof IListInfoProvider) {
|
if (tile instanceof IListInfoProvider) {
|
||||||
((IListInfoProvider) tile).addInfo(event.getToolTip(), false);
|
((IListInfoProvider) tile).addInfo(event.getToolTip(), false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@ public class IC2Dict {
|
||||||
IC2Duplicates.IRON_FURNACE.setIc2Stack(BlockName.te.getItemStack(TeBlock.iron_furnace.getName()));
|
IC2Duplicates.IRON_FURNACE.setIc2Stack(BlockName.te.getItemStack(TeBlock.iron_furnace.getName()));
|
||||||
IC2Duplicates.GENERATOR.setIc2Stack(BlockName.te.getItemStack(TeBlock.generator.getName()));
|
IC2Duplicates.GENERATOR.setIc2Stack(BlockName.te.getItemStack(TeBlock.generator.getName()));
|
||||||
IC2Duplicates.EXTRACTOR.setIc2Stack(BlockName.te.getItemStack(TeBlock.extractor.getName()));
|
IC2Duplicates.EXTRACTOR.setIc2Stack(BlockName.te.getItemStack(TeBlock.extractor.getName()));
|
||||||
IC2Duplicates.SOLAR_PANEL.setIc2Stack(BlockName.te.getItemStack(TeBlock.solar_generator.getName()));
|
|
||||||
IC2Duplicates.RECYCLER.setIc2Stack(BlockName.te.getItemStack(TeBlock.recycler.getName()));
|
IC2Duplicates.RECYCLER.setIc2Stack(BlockName.te.getItemStack(TeBlock.recycler.getName()));
|
||||||
IC2Duplicates.COMPRESSOR.setIc2Stack(BlockName.te.getItemStack(TeBlock.compressor.getName()));
|
IC2Duplicates.COMPRESSOR.setIc2Stack(BlockName.te.getItemStack(TeBlock.compressor.getName()));
|
||||||
IC2Duplicates.BAT_BOX.setIc2Stack(BlockName.te.getItemStack(TeBlock.batbox.getName()));
|
IC2Duplicates.BAT_BOX.setIc2Stack(BlockName.te.getItemStack(TeBlock.batbox.getName()));
|
||||||
|
|
|
@ -41,7 +41,6 @@ public enum IC2Duplicates {
|
||||||
IRON_FURNACE(new ItemStack(ModBlocks.IRON_FURNACE)),
|
IRON_FURNACE(new ItemStack(ModBlocks.IRON_FURNACE)),
|
||||||
GENERATOR(new ItemStack(ModBlocks.SOLID_FUEL_GENEREATOR)),
|
GENERATOR(new ItemStack(ModBlocks.SOLID_FUEL_GENEREATOR)),
|
||||||
EXTRACTOR(new ItemStack(ModBlocks.EXTRACTOR)),
|
EXTRACTOR(new ItemStack(ModBlocks.EXTRACTOR)),
|
||||||
SOLAR_PANEL(new ItemStack(ModBlocks.SOLAR_PANEL)),
|
|
||||||
RECYCLER(new ItemStack(ModBlocks.RECYCLER)),
|
RECYCLER(new ItemStack(ModBlocks.RECYCLER)),
|
||||||
COMPRESSOR(new ItemStack(ModBlocks.COMPRESSOR)),
|
COMPRESSOR(new ItemStack(ModBlocks.COMPRESSOR)),
|
||||||
BAT_BOX(new ItemStack(ModBlocks.LOW_VOLTAGE_SU)),
|
BAT_BOX(new ItemStack(ModBlocks.LOW_VOLTAGE_SU)),
|
||||||
|
|
|
@ -40,6 +40,7 @@ import techreborn.blocks.*;
|
||||||
import techreborn.blocks.advanced_machine.*;
|
import techreborn.blocks.advanced_machine.*;
|
||||||
import techreborn.blocks.cable.BlockCable;
|
import techreborn.blocks.cable.BlockCable;
|
||||||
import techreborn.blocks.generator.*;
|
import techreborn.blocks.generator.*;
|
||||||
|
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
|
||||||
import techreborn.blocks.iron_machines.BlockIronAlloyFurnace;
|
import techreborn.blocks.iron_machines.BlockIronAlloyFurnace;
|
||||||
import techreborn.blocks.iron_machines.BlockIronFurnace;
|
import techreborn.blocks.iron_machines.BlockIronFurnace;
|
||||||
import techreborn.blocks.lighting.BlockLamp;
|
import techreborn.blocks.lighting.BlockLamp;
|
||||||
|
@ -333,7 +334,7 @@ public class ModBlocks {
|
||||||
GameRegistry.registerTileEntity(TileElectricFurnace.class, "TileElectricFurnaceTR");
|
GameRegistry.registerTileEntity(TileElectricFurnace.class, "TileElectricFurnaceTR");
|
||||||
|
|
||||||
SOLAR_PANEL = new BlockSolarPanel();
|
SOLAR_PANEL = new BlockSolarPanel();
|
||||||
registerBlock(SOLAR_PANEL, "solar_panel");
|
registerBlock(SOLAR_PANEL, ItemBlockSolarPanel.class, "solar_panel");
|
||||||
GameRegistry.registerTileEntity(TileSolarPanel.class, "TileSolarPanelTR");
|
GameRegistry.registerTileEntity(TileSolarPanel.class, "TileSolarPanelTR");
|
||||||
|
|
||||||
CREATIVE_SOLAR_PANEL = new BlockCreativeSolarPanel();
|
CREATIVE_SOLAR_PANEL = new BlockCreativeSolarPanel();
|
||||||
|
|
|
@ -148,6 +148,15 @@ public class CraftingTableRecipes extends RecipeMethods {
|
||||||
registerShaped(getStack(ModBlocks.DRAGON_EGG_SYPHON), "CTC", "PSP", "CBC", 'C', "circuitMaster", 'T', getStack(IC2Duplicates.MFE), 'P', "plateIridiumAlloy", 'S', "craftingSuperconductor", 'B', getStack(ModItems.LAPOTRONIC_ORB));
|
registerShaped(getStack(ModBlocks.DRAGON_EGG_SYPHON), "CTC", "PSP", "CBC", 'C', "circuitMaster", 'T', getStack(IC2Duplicates.MFE), 'P', "plateIridiumAlloy", 'S', "craftingSuperconductor", 'B', getStack(ModItems.LAPOTRONIC_ORB));
|
||||||
registerShaped(getStack(ModBlocks.PLASMA_GENERATOR), "PPP", "PTP", "CGC", 'P', "plateTungstensteel", 'T', getStack(IC2Duplicates.HVT), 'C', "circuitMaster", 'G', getStack(IC2Duplicates.GENERATOR));
|
registerShaped(getStack(ModBlocks.PLASMA_GENERATOR), "PPP", "PTP", "CGC", 'P', "plateTungstensteel", 'T', getStack(IC2Duplicates.HVT), 'C', "circuitMaster", 'G', getStack(IC2Duplicates.GENERATOR));
|
||||||
registerShaped(getStack(ModBlocks.DISTILLATION_TOWER), "ICI", "PFP", "ECE", 'I', getStack(ModBlocks.INDUSTRIAL_CENTRIFUGE), 'C', "circuitMaster", 'P', "plateAluminum", 'F', "machineBlockElite", 'E', getStack(ModBlocks.INDUSTRIAL_ELECTROLYZER));
|
registerShaped(getStack(ModBlocks.DISTILLATION_TOWER), "ICI", "PFP", "ECE", 'I', getStack(ModBlocks.INDUSTRIAL_CENTRIFUGE), 'C', "circuitMaster", 'P', "plateAluminum", 'F', "machineBlockElite", 'E', getStack(ModBlocks.INDUSTRIAL_ELECTROLYZER));
|
||||||
|
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 0), "DLD", "LDL", "CGC", 'D', "dustCoal", 'L', "blockGlass", 'G', getStack(IC2Duplicates.GENERATOR), 'C', "circuitBasic");
|
||||||
|
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 1), "DLD", "LDL", "CPC", 'D', "dustCoal", 'L', "blockGlass", 'C', "circuitAdvanced", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 0));
|
||||||
|
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 1), "DLD", "LDL", "CPC", 'D', "dustCoal", 'L', "blockGlass", 'C', "circuitAdvanced", 'P', "machineBlockBasic");
|
||||||
|
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 2), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "blockGlass", 'C', "circuitAdvanced", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 1));
|
||||||
|
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 2), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "blockGlass", 'C', "circuitAdvanced", 'P', "machineBlockBasic");
|
||||||
|
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 3), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', getStack(ModBlocks.REINFORCED_GLASS), 'C', "circuitAdvanced", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 2));
|
||||||
|
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 3), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', getStack(ModBlocks.REINFORCED_GLASS), 'C', "circuitAdvanced", 'P', "machineBlockAdvanced");
|
||||||
|
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', getStack(ModBlocks.REINFORCED_GLASS), 'C', "circuitMaster", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 3));
|
||||||
|
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', getStack(ModBlocks.REINFORCED_GLASS), 'C', "circuitMaster", 'P', "machineBlockElite");
|
||||||
|
|
||||||
if (!IC2Duplicates.deduplicate()) {
|
if (!IC2Duplicates.deduplicate()) {
|
||||||
registerShaped(getStack(IC2Duplicates.HVT), " H ", " M ", " H ", 'M', getStack(IC2Duplicates.MVT), 'H', getStack(IC2Duplicates.CABLE_IHV));
|
registerShaped(getStack(IC2Duplicates.HVT), " H ", " M ", " H ", 'M', getStack(IC2Duplicates.MVT), 'H', getStack(IC2Duplicates.CABLE_IHV));
|
||||||
|
@ -163,7 +172,6 @@ public class CraftingTableRecipes extends RecipeMethods {
|
||||||
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', getMaterial("machine", Type.MACHINE_FRAME), '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");
|
|
||||||
registerShapeless(getStack(IC2Duplicates.FREQ_TRANSMITTER), getStack(IC2Duplicates.CABLE_ICOPPER), "circuitBasic");
|
registerShapeless(getStack(IC2Duplicates.FREQ_TRANSMITTER), getStack(IC2Duplicates.CABLE_ICOPPER), "circuitBasic");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
36
src/main/java/techreborn/itemblocks/ItemBlockSolarPanel.java
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* 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.itemblocks;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import reborncore.common.itemblock.ItemBlockBase;
|
||||||
|
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
|
||||||
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
|
public class ItemBlockSolarPanel extends ItemBlockBase {
|
||||||
|
public ItemBlockSolarPanel(Block block){
|
||||||
|
super(ModBlocks.SOLAR_PANEL, ModBlocks.SOLAR_PANEL, BlockSolarPanel.panes);
|
||||||
|
}
|
||||||
|
}
|
|
@ -45,7 +45,7 @@ public class ItemParts extends ItemTR {
|
||||||
"thorium_cell", "double_thorium_cell", "quad_thorium_cell", "plutonium_cell", "double_plutonium_cell",
|
"thorium_cell", "double_thorium_cell", "quad_thorium_cell", "plutonium_cell", "double_plutonium_cell",
|
||||||
"quad_plutonium_cell", "computer_monitor", "machine_parts", "neutron_reflector", "iridium_neutron_reflector",
|
"quad_plutonium_cell", "computer_monitor", "machine_parts", "neutron_reflector", "iridium_neutron_reflector",
|
||||||
"thick_neutron_reflector", "electronic_circuit", "advanced_circuit", "sap", "rubber", "scrap",
|
"thick_neutron_reflector", "electronic_circuit", "advanced_circuit", "sap", "rubber", "scrap",
|
||||||
"carbon_mesh", "carbon_fiber", "coolant_simple", "coolant_triple", "coolant_six" };
|
"carbon_mesh", "carbon_fiber", "coolant_simple", "coolant_triple", "coolant_six"};
|
||||||
|
|
||||||
public ItemParts() {
|
public ItemParts() {
|
||||||
this.setCreativeTab(TechRebornCreativeTab.instance);
|
this.setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
|
|
|
@ -224,7 +224,6 @@ public class TileFusionControlComputer extends TilePowerAcceptor implements IToo
|
||||||
if (hasStartedCrafting && this.crafingTickTime < this.finalTickTime) {
|
if (hasStartedCrafting && this.crafingTickTime < this.finalTickTime) {
|
||||||
this.crafingTickTime++;
|
this.crafingTickTime++;
|
||||||
// Power gen
|
// Power gen
|
||||||
|
|
||||||
if (this.currentRecipe.getEuTick() > 0) {
|
if (this.currentRecipe.getEuTick() > 0) {
|
||||||
// Waste power if it has no where to go
|
// Waste power if it has no where to go
|
||||||
this.addEnergy(this.currentRecipe.getEuTick());
|
this.addEnergy(this.currentRecipe.getEuTick());
|
||||||
|
|
|
@ -26,79 +26,69 @@ package techreborn.tiles.generator;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import reborncore.api.IToolDrop;
|
import reborncore.api.IToolDrop;
|
||||||
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.common.registration.RebornRegistry;
|
import reborncore.common.util.StringUtils;
|
||||||
import reborncore.common.registration.impl.ConfigRegistry;
|
import techreborn.Core;
|
||||||
import techreborn.blocks.generator.BlockSolarPanel;
|
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
|
||||||
|
import techreborn.blocks.generator.solarpanel.EnumPanelType;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.lib.ModInfo;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by modmuss50 on 25/02/2016.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
|
||||||
public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
||||||
|
|
||||||
@ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxOutput", comment = "Solar Panel Max Output (Value in EU)")
|
boolean canSeeSky = false;
|
||||||
public static int maxOutput = 32;
|
boolean lastSate = false;
|
||||||
@ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxEnergy", comment = "Solar Panel Max Energy (Value in EU)")
|
|
||||||
public static int maxEnergy = 1000;
|
|
||||||
@ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelEnergyPerTick", comment = "Solar Panel Energy Per Tick (Value in EU)")
|
|
||||||
public static int energyPerTick = 1;
|
|
||||||
|
|
||||||
boolean shouldMakePower = false;
|
|
||||||
boolean lastTickSate = false;
|
|
||||||
|
|
||||||
int powerToAdd;
|
int powerToAdd;
|
||||||
|
EnumPanelType panel;
|
||||||
|
|
||||||
|
//This is left here to allow the world to create a new instance of it when loading, do not remove this.
|
||||||
public TileSolarPanel() {
|
public TileSolarPanel() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TileSolarPanel(EnumPanelType panel) {
|
||||||
|
this.panel = panel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
if (!this.world.isRemote) {
|
if (this.world.isRemote) {
|
||||||
if (this.world.getTotalWorldTime() % 60 == 0) {
|
return;
|
||||||
this.shouldMakePower = this.isSunOut();
|
}
|
||||||
|
if (world.getTotalWorldTime() % 20 == 0) {
|
||||||
}
|
canSeeSky = this.world.canBlockSeeSky(this.pos.up());
|
||||||
if (this.shouldMakePower) {
|
if(lastSate != this.isSunOut()){
|
||||||
this.powerToAdd = energyPerTick;
|
this.world.setBlockState(this.getPos(),
|
||||||
this.addEnergy(this.powerToAdd);
|
this.world.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, this.isSunOut()));
|
||||||
} else {
|
lastSate = isSunOut();
|
||||||
this.powerToAdd = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.world.setBlockState(this.getPos(),
|
|
||||||
this.world.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, this.isSunOut()));
|
|
||||||
}
|
}
|
||||||
}
|
if (isSunOut()) {
|
||||||
|
this.powerToAdd = panel.generationRateD;
|
||||||
|
} else if (canSeeSky) {
|
||||||
|
this.powerToAdd = panel.generationRateN;
|
||||||
|
} else {
|
||||||
|
this.powerToAdd = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
this.addEnergy(this.powerToAdd);
|
||||||
public void addInfo(final List<String> info, final boolean isRealTile) {
|
|
||||||
super.addInfo(info, isRealTile);
|
|
||||||
if (isRealTile) {
|
|
||||||
// FIXME: 25/02/2016
|
|
||||||
// info.add(TextFormatting.LIGHT_PURPLE + "Power gen/tick " +
|
|
||||||
// TextFormatting.GREEN + PowerSystem.getLocaliszedPower(
|
|
||||||
// powerToAdd)) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSunOut() {
|
public boolean isSunOut() {
|
||||||
return this.world.canBlockSeeSky(this.pos.up()) && !this.world.isRaining() && !this.world.isThundering()
|
return canSeeSky && !this.world.isRaining() && !this.world.isThundering() && this.world.isDaytime();
|
||||||
&& this.world.isDaytime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getBaseMaxPower() {
|
public double getBaseMaxPower() {
|
||||||
return maxEnergy;
|
return panel.internalCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -113,7 +103,7 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getBaseMaxOutput() {
|
public double getBaseMaxOutput() {
|
||||||
return maxOutput;
|
return panel.generationRateD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -122,7 +112,53 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getToolDrop(final EntityPlayer p0) {
|
public EnumPowerTier getTier() {
|
||||||
return new ItemStack(ModBlocks.SOLAR_PANEL);
|
return this.panel.powerTier;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public EnumPowerTier getBaseTier() {
|
||||||
|
return getTier();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getToolDrop(final EntityPlayer p0) {
|
||||||
|
return new ItemStack(ModBlocks.SOLAR_PANEL, 1, world.getBlockState(pos).getBlock().getMetaFromState(world.getBlockState(pos)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound tag) {
|
||||||
|
if(tag.hasKey("panelType")){
|
||||||
|
panel = EnumPanelType.values()[tag.getInteger("panelType")];
|
||||||
|
} else {
|
||||||
|
Core.logHelper.warn("A solar panel has failed to load from NBT, it will not work correctly. Please break and replace it to fix the issue. BlockPos:" + pos.toString());
|
||||||
|
panel = EnumPanelType.Basic;
|
||||||
|
}
|
||||||
|
super.readFromNBT(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||||
|
tag.setInteger("panelType", panel.ordinal());
|
||||||
|
return super.writeToNBT(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkTeir() {
|
||||||
|
//Nope
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInfo(List<String> info, boolean isRealTile) {
|
||||||
|
info.add(TextFormatting.GRAY + "Internal Energy Storage: " + TextFormatting.GOLD
|
||||||
|
+ getLocaliszedPowerFormatted((int) getMaxPower()));
|
||||||
|
|
||||||
|
info.add(TextFormatting.GRAY + "Generation Rate Day: " + TextFormatting.GOLD
|
||||||
|
+ getLocaliszedPowerFormatted(panel.generationRateD));
|
||||||
|
|
||||||
|
info.add(TextFormatting.GRAY + "Generation Rate Night: " + TextFormatting.GOLD
|
||||||
|
+ getLocaliszedPowerFormatted(panel.generationRateN));
|
||||||
|
|
||||||
|
info.add(TextFormatting.GRAY + "Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(getTier().toString()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,22 +1,20 @@
|
||||||
{
|
{
|
||||||
"forge_marker": 1,
|
"forge_marker": 1,
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"transform": "forge:default-block",
|
|
||||||
"model": "cube_bottom_top",
|
|
||||||
"textures": {
|
"textures": {
|
||||||
"particle": "techreborn:blocks/machines/generators/solar_panel_side_off",
|
"particle": "techreborn:blocks/machines/generators/generator_bottom",
|
||||||
"top": "techreborn:blocks/machines/generators/solar_panel_top",
|
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||||
"down": "techreborn:blocks/machines/generators/generator_bottom"
|
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
||||||
}
|
},
|
||||||
|
"transform": "forge:default-block",
|
||||||
|
"model": "cube_bottom_top"
|
||||||
},
|
},
|
||||||
"variants": {
|
"variants": {
|
||||||
"inventory": {
|
"inventory": {
|
||||||
"transform": "forge:default-block",
|
"transform": "forge:default-block",
|
||||||
"model": "cube_bottom_top",
|
"model": "orientable",
|
||||||
"textures": {
|
"textures": {}
|
||||||
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
"active": {
|
"active": {
|
||||||
"true": {
|
"true": {
|
||||||
"textures": {
|
"textures": {
|
||||||
|
@ -28,7 +26,33 @@
|
||||||
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"basic": {
|
||||||
|
"textures": {
|
||||||
|
"top": "techreborn:blocks/machines/generators/panels/basicsolar_panel_top"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hybrid": {
|
||||||
|
"textures": {
|
||||||
|
"top": "techreborn:blocks/machines/generators/panels/hybridsolar_panel_top"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"advanced": {
|
||||||
|
"textures": {
|
||||||
|
"top": "techreborn:blocks/machines/generators/panels/advancedsolar_panel_top"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ultimate": {
|
||||||
|
"textures": {
|
||||||
|
"top": "techreborn:blocks/machines/generators/panels/ultimatesolar_panel_top"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"quantum": {
|
||||||
|
"textures": {
|
||||||
|
"top": "techreborn:blocks/machines/generators/panels/quantumsolar_panel_top"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,12 @@ tile.techreborn:machine_frame.advanced.name=Advanced Machine Frame
|
||||||
tile.techreborn:machine_frame.basic.name=Basic Machine Frame
|
tile.techreborn:machine_frame.basic.name=Basic Machine Frame
|
||||||
tile.techreborn:ore2.copper.name=Copper Ore
|
tile.techreborn:ore2.copper.name=Copper Ore
|
||||||
tile.techreborn:ore2.tin.name=Tin Ore
|
tile.techreborn:ore2.tin.name=Tin Ore
|
||||||
tile.techreborn:solar_panel.name=Solar Panel
|
tile.techreborn:solar_panel.basic.name=Basic Solar Panel
|
||||||
|
tile.techreborn:solar_panel.hybrid.name=Hybrid Solar Panel
|
||||||
|
tile.techreborn:solar_panel.advanced.name=Advanced Solar Panel
|
||||||
|
tile.techreborn:solar_panel.ultimate.name=Ultimate Solar Panel
|
||||||
|
tile.techreborn:solar_panel.quantum.name=Quantum Solar Panel
|
||||||
|
|
||||||
tile.techreborn:creative_solar_panel.name=Creative Panel
|
tile.techreborn:creative_solar_panel.name=Creative Panel
|
||||||
tile.techreborn:water_mill.name=Water Mill
|
tile.techreborn:water_mill.name=Water Mill
|
||||||
tile.techreborn:wind_mill.name=Wind Mill
|
tile.techreborn:wind_mill.name=Wind Mill
|
||||||
|
|
Before Width: | Height: | Size: 787 B After Width: | Height: | Size: 787 B |
After Width: | Height: | Size: 813 B |
Before Width: | Height: | Size: 777 B After Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 792 B After Width: | Height: | Size: 792 B |
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 775 B |