MOre work on solar panels. Blockstate json isn't ready yet.

This commit is contained in:
drcrazy 2018-09-19 18:24:35 +03:00
parent 4245decc3c
commit b7a0854cae
22 changed files with 125 additions and 305 deletions

View file

@ -201,7 +201,7 @@ public class TechReborn {
localName.append(StringUtils.toFirstCapital(word));
}
}
System.out.println("item.techreborn." + item.getRegistryName().getPath() + ".name=" + localName);
// System.out.println("item.techreborn." + item.getRegistryName().getPath() + ".name=" + localName);
}
}
for (Block item : ForgeRegistries.BLOCKS.getValues()) {
@ -216,7 +216,7 @@ public class TechReborn {
localName.append(StringUtils.toFirstCapital(word));
}
}
System.out.println("tile.techreborn." + item.getRegistryName().getPath() + ".name=" + localName);
// System.out.println("tile.techreborn." + item.getRegistryName().getPath() + ".name=" + localName);
}
}
}

View file

@ -31,6 +31,8 @@ import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.TechReborn;
import techreborn.init.TRContent.SolarPanels;
import techreborn.tiles.generator.TileSolarPanel;
import techreborn.utils.TechRebornCreativeTab;
/**
@ -38,16 +40,18 @@ import techreborn.utils.TechRebornCreativeTab;
*/
public class BlockSolarPanel extends BlockMachineBase {
public BlockSolarPanel() {
public final SolarPanels panelType;
public BlockSolarPanel(SolarPanels panel) {
super();
this.panelType = panel;
setCreativeTab(TechRebornCreativeTab.instance);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/generators"));
}
@Override
public TileEntity createNewTileEntity(final World world, final int meta) {
// TODO: FIx me
return null;
return new TileSolarPanel();
}
@Override

View file

@ -1,87 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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;
import techreborn.config.ConfigTechReborn;
public enum EnumPanelType implements IStringSerializable {
Basic("basic", EnumPowerTier.MICRO),
Hybrid("hybrid", EnumPowerTier.LOW),
Advanced("advanced", EnumPowerTier.MEDIUM),
Ultimate("ultimate", EnumPowerTier.HIGH),
Quantum("quantum", EnumPowerTier.EXTREME),
CREATIVE("creative", EnumPowerTier.EXTREME);
private String friendlyName;
// Generation of EU during Day
public int generationRateD = 1;
// 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, EnumPowerTier tier) {
this.friendlyName = friendlyName;
this.powerTier = tier;
// TODO: Fix me
switch (friendlyName) {
case "basic":
this.generationRateD = ConfigTechReborn.basicGenerationRateD;
this.generationRateN = ConfigTechReborn.basicGenerationRateN;
break;
case "hybrid":
this.generationRateD = ConfigTechReborn.hybridGenerationRateD;
this.generationRateN = ConfigTechReborn.hybridGenerationRateN;
break;
case "advanced":
this.generationRateD = ConfigTechReborn.advancedGenerationRateD;
this.generationRateN = ConfigTechReborn.advancedGenerationRateN;
break;
case "ultimate":
this.generationRateD = ConfigTechReborn.ultimateGenerationRateD;
this.generationRateN = ConfigTechReborn.ultimateGenerationRateN;
break;
case "quantum":
this.generationRateD = ConfigTechReborn.quantumGenerationRateD;
this.generationRateN = ConfigTechReborn.quantumGenerationRateN;
break;
}
this.internalCapacity = (this.generationRateD * 1000);
}
@Override
public String getName() {
return friendlyName;
}
}

View file

@ -93,34 +93,34 @@ public class ConfigTechReborn {
@ConfigRegistry(config = "items", category = "power", key = "clockingDeviceEnergyUsage", comment = "Cloacking device energy usesage (FE)")
public static int CloackingDeviceUsage = 10;
@ConfigRegistry(config = "generators", category = "solarPanelBasic", key = "basicDayRate", comment = "Generation rate during day for Basic Solar Panel (Value in EU)")
@ConfigRegistry(config = "generators", category = "solarPanelBasic", key = "basicDayRate", comment = "Generation rate during day for Basic Solar Panel (Value in FE)")
public static int basicGenerationRateD = 1;
@ConfigRegistry(config = "generators", category = "solarPanelBasic", key = "basicNightRate", comment = "Generation rate during night for Basic Solar Panel (Value in EU)")
@ConfigRegistry(config = "generators", category = "solarPanelBasic", key = "basicNightRate", comment = "Generation rate during night for Basic Solar Panel (Value in FE)")
public static int basicGenerationRateN = 0;
@ConfigRegistry(config = "generators", category = "solarPanelHybrid", key = "hybridDayRate", comment = "Generation rate during day for Hybrid Solar Panel (Value in EU)")
public static int hybridGenerationRateD = 16;
@ConfigRegistry(config = "generators", category = "solarPanelAdvanced", key = "advancedDayRate", comment = "Generation rate during day for Advanced Solar Panel (Value in FE)")
public static int advancedGenerationRateD = 16;
@ConfigRegistry(config = "generators", category = "solarPanelHybrid", key = "hybridNightRate", comment = "Generation rate during night for Hybrid Solar Panel (Value in EU)")
public static int hybridGenerationRateN = 0;
@ConfigRegistry(config = "generators", category = "solarPanelAdvanced", key = "advancedNightRate", comment = "Generation rate during night for Advanced Solar Panel (Value in FE)")
public static int advancedGenerationRateN = 0;
@ConfigRegistry(config = "generators", category = "solarPanelAdvanced", key = "advancedDayRate", comment = "Generation rate during day for Advanced Solar Panel (Value in EU)")
public static int advancedGenerationRateD = 64;
@ConfigRegistry(config = "generators", category = "solarPanelIndustrial", key = "industrialDayRate", comment = "Generation rate during day for Industrial Solar Panel (Value in FE)")
public static int industrialGenerationRateD = 64;
@ConfigRegistry(config = "generators", category = "solarPanelAdvanced", key = "advancedNightRate", comment = "Generation rate during night for Advanced Solar Panel (Value in EU)")
public static int advancedGenerationRateN = 2;
@ConfigRegistry(config = "generators", category = "solarPanelIndustrial", key = "industrialNightRate", comment = "Generation rate during night for Industrial Solar Panel (Value in FE)")
public static int industrialGenerationRateN = 2;
@ConfigRegistry(config = "generators", category = "solarPanelUltimate", key = "ultimateDayRate", comment = "Generation rate during day for Ultimate Solar Panel (Value in EU)")
@ConfigRegistry(config = "generators", category = "solarPanelUltimate", key = "ultimateDayRate", comment = "Generation rate during day for Ultimate Solar Panel (Value in FE)")
public static int ultimateGenerationRateD = 256;
@ConfigRegistry(config = "generators", category = "solarPanelUltimate", key = "ultimateNightRate", comment = "Generation rate during night for Ultimate Solar Panel (Value in EU)")
@ConfigRegistry(config = "generators", category = "solarPanelUltimate", key = "ultimateNightRate", comment = "Generation rate during night for Ultimate Solar Panel (Value in FE)")
public static int ultimateGenerationRateN = 16;
@ConfigRegistry(config = "generators", category = "solarPanelQuantum", key = "quantumDayRate", comment = "Generation rate during day for Quantum Solar Panel (Value in EU)")
@ConfigRegistry(config = "generators", category = "solarPanelQuantum", key = "quantumDayRate", comment = "Generation rate during day for Quantum Solar Panel (Value in FE)")
public static int quantumGenerationRateD = 1024;
@ConfigRegistry(config = "generators", category = "solarPanelQuantum", key = "quantumNightRate", comment = "Generation rate during night for Quantum Solar Panel (Value in EU)")
@ConfigRegistry(config = "generators", category = "solarPanelQuantum", key = "quantumNightRate", comment = "Generation rate during night for Quantum Solar Panel (Value in FE)")
public static int quantumGenerationRateN = 64;
@ConfigRegistry(config = "world", category = "loot", key = "enableOverworldLoot", comment = "When true TechReborn will add ingots, machine frames and circuits to OverWorld loot chests.")

View file

@ -34,7 +34,6 @@ import techreborn.TechReborn;
import techreborn.blocks.*;
import techreborn.blocks.cable.BlockCable;
import techreborn.blocks.generator.*;
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
import techreborn.blocks.lighting.BlockLamp;
import techreborn.blocks.storage.*;
import techreborn.blocks.tier0.BlockIronAlloyFurnace;
@ -107,13 +106,6 @@ public class ModBlocks {
public static Block LIGHTNING_ROD;
public static Block PLASMA_GENERATOR;
public static Block SEMI_FLUID_GENERATOR;
public static Block SOLAR_PANEL_BASIC;
public static Block SOLAR_PANEL_ADVANCED;
public static Block SOLAR_PANEL_INDUSTRIAL;
public static Block SOLAR_PANEL_ULTIMATE;
public static Block SOLAR_PANEL_QUANTUM;
public static Block SOLAR_PANEL_CREATIVE;
public static Block SOLID_FUEL_GENEREATOR;
public static Block THERMAL_GENERATOR;
public static Block WATER_MILL;
@ -286,24 +278,6 @@ public class ModBlocks {
SEMI_FLUID_GENERATOR = new BlockSemiFluidGenerator();
registerBlock(SEMI_FLUID_GENERATOR, "semi_fluid_generator");
SOLAR_PANEL_BASIC = new BlockSolarPanel();
registerBlock(SOLAR_PANEL_BASIC, "solar_panel_basic");
SOLAR_PANEL_ADVANCED = new BlockSolarPanel();
registerBlock(SOLAR_PANEL_ADVANCED, "solar_panel_advanced");
SOLAR_PANEL_INDUSTRIAL = new BlockSolarPanel();
registerBlock(SOLAR_PANEL_INDUSTRIAL, "solar_panel_industrial");
SOLAR_PANEL_ULTIMATE = new BlockSolarPanel();
registerBlock(SOLAR_PANEL_ULTIMATE, "solar_panel_ultimate");
SOLAR_PANEL_QUANTUM = new BlockSolarPanel();
registerBlock(SOLAR_PANEL_QUANTUM, "solar_panel_quantum");
SOLAR_PANEL_CREATIVE = new BlockSolarPanel();
registerBlock(SOLAR_PANEL_CREATIVE, "solar_panel_creative");
SOLID_FUEL_GENEREATOR = new BlockSolidFuelGenerator();
registerBlock(SOLID_FUEL_GENEREATOR, "solid_fuel_generator");

View file

@ -96,7 +96,6 @@ public enum ModTileEntities {
COMPRESSOR(TileCompressor.class, "compressor"),
ELECTRIC_FURNACE(TileElectricFurnace.class, "electric_furnace"),
SOLAR_PANEL(TileSolarPanel.class, "solar_panel"),
CREATIVE_SOLAR_PANEL(TileCreativeSolarPanel.class, "creative_solar_panel"),
CREATIVE_QUANTUM_TANK(TileCreativeQuantumTank.class, "creative_quantum_tank"),
CREATIVE_QUANTUM_CHEST(TileCreativeQuantumChest.class, "creative_quantum_chest"),
WATER_MILL(TileWaterMill.class, "water_mill"),

View file

@ -12,6 +12,7 @@ import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.RebornRegistry;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.tile.IUpgrade;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister;
@ -21,7 +22,9 @@ import techreborn.blocks.BlockMachineCasing;
import techreborn.blocks.BlockMachineFrame;
import techreborn.blocks.BlockOre;
import techreborn.blocks.BlockStorage;
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
import techreborn.blocks.tier1.BlockElectricFurnace;
import techreborn.config.ConfigTechReborn;
import techreborn.items.ItemUpgrade;
import techreborn.utils.InitUtils;
@ -37,6 +40,7 @@ public class TRContent {
RebornRegistry.registerBlock(value.frame);
RebornRegistry.registerBlock(value.casing);
});
Arrays.stream(SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block));
}
public static void registerItems() {
@ -80,6 +84,10 @@ public class TRContent {
Arrays.stream(Plates.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0,
new ModelResourceLocation(platesRL, "type=" + value.name)));
ResourceLocation upgradeRL = new ResourceLocation(TechReborn.MOD_ID, "items/misc/upgrades");
Arrays.stream(Upgrades.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0,
new ModelResourceLocation(upgradeRL, "type=" + value.name)));
ResourceLocation oresRL = new ResourceLocation(TechReborn.MOD_ID, "ore");
for (Ores value : Ores.values()) {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.block), 0, new ModelResourceLocation(oresRL, "type=" + value.name));
@ -119,10 +127,36 @@ public class TRContent {
}
});
}
}
public static enum SolarPanels {
BASIC(EnumPowerTier.MICRO, ConfigTechReborn.basicGenerationRateD, ConfigTechReborn.basicGenerationRateN),
ADVANCED(EnumPowerTier.LOW, ConfigTechReborn.advancedGenerationRateD, ConfigTechReborn.advancedGenerationRateN),
INDUSTRIAL(EnumPowerTier.MEDIUM, ConfigTechReborn.industrialGenerationRateD, ConfigTechReborn.industrialGenerationRateN),
ULTIMATE(EnumPowerTier.HIGH, ConfigTechReborn.ultimateGenerationRateD, ConfigTechReborn.ultimateGenerationRateN),
QUANTUM(EnumPowerTier.EXTREME, ConfigTechReborn.quantumGenerationRateD, ConfigTechReborn.quantumGenerationRateN),
CREATIVE(EnumPowerTier.INFINITE, Integer.MAX_VALUE, Integer.MAX_VALUE);
public final String name;
public final Block block;
// Generation of EU during Day
public int generationRateD = 1;
// Generation of EU during Night
public int generationRateN = 0;
// Internal EU storage of solar panel
public int internalCapacity = 1000;
public final EnumPowerTier powerTier;
private SolarPanels(EnumPowerTier tier, int generationRateD, int generationRateN) {
name = this.toString().toLowerCase();
powerTier = tier;
block = new BlockSolarPanel(this);
this.generationRateD = generationRateD;
this.generationRateN = generationRateN;
InitUtils.setup(block, "solar_panel_" + name);
}
ResourceLocation upgradeRL = new ResourceLocation(TechReborn.MOD_ID, "items/misc/upgrades");
Arrays.stream(Upgrades.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0,
new ModelResourceLocation(upgradeRL, "type=" + value.name)));
}
public static enum Ores implements IItemProvider {

View file

@ -141,16 +141,16 @@ public class CraftingTableRecipes extends RecipeMethods {
registerShaped(getStack(ModBlocks.PLAYER_DETECTOR, true), " D ", "CFC", " D ", 'D', "circuitStorage", 'C', "circuitAdvanced", 'F', getStack(ModBlocks.COMPUTER_CUBE));
registerShaped(getStack(ModBlocks.DRAGON_EGG_SYPHON), "CTC", "PSP", "CBC", 'C', "circuitMaster", 'T', getStack(ModBlocks.MEDIUM_VOLTAGE_SU), 'P', "plateIridiumAlloy", 'S', "craftingSuperconductor", 'B', getStack(TRItems.LAPOTRONIC_ORB));
registerShaped(getStack(ModBlocks.PLASMA_GENERATOR), "PPP", "PTP", "CGC", 'P', "plateTungstensteel", 'T', getStack(ModBlocks.HV_TRANSFORMER), 'C', "circuitMaster", 'G', getStack(ModBlocks.SOLID_FUEL_GENEREATOR));
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 0), "DLD", "LDL", "CGC", 'D', "dustCoal", 'L', "paneGlass", 'G', getStack(ModBlocks.SOLID_FUEL_GENEREATOR), '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', "glassReinforced", 'C', "circuitAdvanced", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 2));
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 3), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitAdvanced", 'P', "machineBlockAdvanced");
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitMaster", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 3));
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitMaster", 'P', "machineBlockElite");
registerShaped(getStack(ModBlocks.ALARM, 1, 0), "ICI", "SRS", "ICI", 'I', "ingotIron", 'C', getMaterial("copper", Type.CABLE), 'S', getMaterial("insulatedcopper", Type.CABLE), 'R', "blockRedstone" );
// registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 0), "DLD", "LDL", "CGC", 'D', "dustCoal", 'L', "paneGlass", 'G', getStack(ModBlocks.SOLID_FUEL_GENEREATOR), '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', "glassReinforced", 'C', "circuitAdvanced", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 2));
// registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 3), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitAdvanced", 'P', "machineBlockAdvanced");
// registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitMaster", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 3));
// registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitMaster", 'P', "machineBlockElite");
// registerShaped(getStack(ModBlocks.ALARM, 1, 0), "ICI", "SRS", "ICI", 'I', "ingotIron", 'C', getMaterial("copper", Type.CABLE), 'S', getMaterial("insulatedcopper", Type.CABLE), 'R', "blockRedstone" );
registerShaped(getStack(ModBlocks.FLUID_REPLICATOR), "PCP", "CFC", "ESR", 'P', "plateTungstensteel", 'F', "machineBlockElite", 'C', "circuitMaster", 'E', getStack(ModBlocks.INDUSTRIAL_ELECTROLYZER), 'S', "craftingSuperconductor",'R', getStack(ModBlocks.CHEMICAL_REACTOR));
registerShaped(getStack(ModBlocks.HV_TRANSFORMER), " H ", " M ", " H ", 'M', getStack(ModBlocks.MV_TRANSFORMER), 'H', EnumCableType.IHV.getStack());
registerShaped(getStack(ModBlocks.MV_TRANSFORMER), " G ", " M ", " G ", 'M', "machineBlockBasic", 'G', EnumCableType.IGOLD.getStack());

View file

@ -1,90 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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.tiles.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.api.IToolDrop;
import reborncore.api.power.EnumPowerTier;
import reborncore.common.powerSystem.TilePowerAcceptor;
import techreborn.init.ModBlocks;
/**
* Created by modmuss50 on 25/02/2016.
*/
public class TileCreativeSolarPanel extends TilePowerAcceptor implements IToolDrop {
boolean shouldMakePower = false;
boolean lastTickSate = false;
int powerToAdd;
@Override
public void update() {
super.update();
setEnergy(getMaxPower());
}
@Override
public double getBaseMaxPower() {
return 1_000_000;
}
@Override
public boolean canAcceptEnergy(final EnumFacing direction) {
return false;
}
@Override
public boolean canProvideEnergy(final EnumFacing direction) {
return true;
}
@Override
public double getBaseMaxOutput() {
return 16_192;
}
@Override
public double getBaseMaxInput() {
return 0;
}
@Override
public EnumPowerTier getBaseTier() {
return EnumPowerTier.INFINITE;
}
@Override
public ItemStack getToolDrop(final EntityPlayer p0) {
return new ItemStack(ModBlocks.SOLAR_PANEL);
}
@Override
public boolean handleTierWithPower() {
return false;
}
}

View file

@ -24,9 +24,9 @@
package techreborn.tiles.generator;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.TextFormatting;
import reborncore.api.IToolDrop;
@ -34,29 +34,22 @@ import reborncore.api.power.EnumPowerTier;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.StringUtils;
import techreborn.TechReborn;
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
import techreborn.blocks.generator.solarpanel.EnumPanelType;
import techreborn.init.ModBlocks;
import techreborn.init.TRContent.SolarPanels;
import java.util.List;
public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
boolean canSeeSky = false;
boolean lastSate = false;
int powerToAdd;
EnumPanelType panel;
boolean lastState = false;
SolarPanels panel;
//This is left here to allow the world to create a new instance of it when loading, do not remove this.
public TileSolarPanel() {
super();
}
public TileSolarPanel(EnumPanelType panel) {
this.panel = panel;
public boolean isSunOut() {
return canSeeSky && !world.isRaining() && !world.isThundering() && world.isDaytime();
}
// TilePowerAcceptor
@Override
public void update() {
super.update();
@ -65,13 +58,12 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
}
if (world.getTotalWorldTime() % 20 == 0) {
canSeeSky = world.canBlockSeeSky(pos.up());
if (lastSate != isSunOut()) {
world.setBlockState(pos,
world.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
lastSate = isSunOut();
if (lastState != isSunOut()) {
world.setBlockState(pos, world.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
lastState = isSunOut();
}
}
int powerToAdd;
if (isSunOut()) {
powerToAdd = panel.generationRateD;
} else if (canSeeSky) {
@ -83,10 +75,6 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
addEnergy(powerToAdd);
}
public boolean isSunOut() {
return canSeeSky && !world.isRaining() && !world.isThundering() && world.isDaytime();
}
@Override
public double getBaseMaxPower() {
return panel.internalCapacity;
@ -122,44 +110,42 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
return getTier();
}
@Override
public ItemStack getToolDrop(final EntityPlayer playerIn) {
return new ItemStack(ModBlocks.SOLAR_PANEL, 1, panel.ordinal());
}
@Override
public void readFromNBT(NBTTagCompound tag) {
if (tag.hasKey("panelType")) {
panel = EnumPanelType.values()[tag.getInteger("panelType")];
} else {
TechReborn.LOGGER.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 checkTier() {
//Nope
// Nope
}
// TODO: Translate
@Override
public void addInfo(List<String> info, boolean isRealTile) {
info.add(TextFormatting.GRAY + "Internal Energy Storage: " + TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted((int) getMaxPower()));
+ PowerSystem.getLocaliszedPowerFormatted((int) getMaxPower()));
info.add(TextFormatting.GRAY + "Generation Rate Day: " + TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD));
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD));
info.add(TextFormatting.GRAY + "Generation Rate Night: " + TextFormatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN));
+ PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN));
info.add(TextFormatting.GRAY + "Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(getTier().toString()));
info.add(TextFormatting.GRAY + "Tier: " + TextFormatting.GOLD
+ StringUtils.toFirstCapitalAllLowercase(getTier().toString()));
}
// TileMachineBase
@Override
public void onLoad() {
super.onLoad();
Block panelBlock = world.getBlockState(pos).getBlock();
if (panelBlock instanceof BlockSolarPanel) {
BlockSolarPanel solarPanelBlock = (BlockSolarPanel) panelBlock;
panel = solarPanelBlock.panelType;
}
}
// IToolDrop
@Override
public ItemStack getToolDrop(final EntityPlayer playerIn) {
// return new ItemStack(ModBlocks.SOLAR_PANEL, 1, panel.ordinal());
return null;
}
}

View file

@ -111,7 +111,7 @@
},
{
"type": "item",
"name": "techreborn:machineblockbasic",
"name": "techreborn:basic_machine_frame",
"entryName": "basic_frame",
"weight": 5
},

View file

@ -111,7 +111,7 @@
},
{
"type": "item",
"name": "techreborn:machineblockbasic",
"name": "techreborn:basic_machine_frame",
"entryName": "basic_frame",
"weight": 5
},

View file

@ -99,8 +99,8 @@
},
{
"type": "item",
"name": "techreborn:machineblockelite",
"entryName": "highly_advanced_frame",
"name": "techreborn:industrial_machine_frame",
"entryName": "tier3_machine_block",
"weight": 30
},
{

View file

@ -111,7 +111,7 @@
},
{
"type": "item",
"name": "techreborn:machineblockbasic",
"name": "techreborn:basic_machine_frame",
"entryName": "basic_frame",
"weight": 5
},

View file

@ -111,7 +111,7 @@
},
{
"type": "item",
"name": "techreborn:machineblockbasic",
"name": "techreborn:basic_machine_frame",
"entryName": "basic_frame",
"weight": 5
},

View file

@ -114,8 +114,8 @@
},
{
"type": "item",
"name": "techreborn:machineblockadvanced",
"entryName": "reinforced_frame",
"name": "techreborn:advanced_machine_frame",
"entryName": "tier2_machine_block",
"weight": 30
},
{

View file

@ -111,7 +111,7 @@
},
{
"type": "item",
"name": "techreborn:machineblockbasic",
"name": "techreborn:basic_machine_frame",
"entryName": "basic_frame",
"weight": 5
},

View file

@ -114,8 +114,8 @@
},
{
"type": "item",
"name": "techreborn:machineblockadvanced",
"entryName": "reinforced_frame",
"name": "techreborn:advanced_machine_frame",
"entryName": "tier2_machine_block",
"weight": 30
},
{

View file

@ -114,8 +114,8 @@
},
{
"type": "item",
"name": "techreborn:machineblockadvanced",
"entryName": "reinforced_frame",
"name": "techreborn:advanced_machine_frame",
"entryName": "tier2_machine_block",
"weight": 30
},
{

View file

@ -114,8 +114,8 @@
},
{
"type": "item",
"name": "techreborn:machineblockadvanced",
"entryName": "reinforced_frame",
"name": "techreborn:advanced_machine_frame",
"entryName": "tier2_machine_block",
"weight": 30
},
{

View file

@ -111,7 +111,7 @@
},
{
"type": "item",
"name": "techreborn:machineblockbasic",
"name": "techreborn:basic_machine_frame",
"entryName": "basic_frame",
"weight": 5
},

View file

@ -99,8 +99,8 @@
},
{
"type": "item",
"name": "techreborn:machineblockelite",
"entryName": "highly_advanced_frame",
"name": "techreborn:industrial_machine_frame",
"entryName": "tier3_machine_block",
"weight": 30
},
{