Textures and block work.
|
@ -25,20 +25,29 @@
|
|||
package techreborn.blocks.generator.solarpanel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
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 reborncore.common.util.ArrayUtils;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.generator.TileSolarPanel;
|
||||
|
@ -48,22 +57,25 @@ import techreborn.tiles.generator.TileSolarPanel;
|
|||
*/
|
||||
public class BlockSolarPanel extends BaseTileBlock {
|
||||
public static final String[] panes = new String[] {
|
||||
"basic", "hybrid", "advanced", "ultimate", "quantum"};
|
||||
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumPanelType.class);
|
||||
"Basic", "Hybrid", "Advanced", "Ultimate", "Quantum"};
|
||||
public static final IProperty<EnumPanelType> TYPE = PropertyEnum.create("type", EnumPanelType.class);
|
||||
private static final List<String> paneList = Lists.newArrayList(panes);
|
||||
|
||||
public BlockSolarPanel() {
|
||||
super(Material.IRON);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
this.setDefaultState(this.getBlockState().getBaseState().withProperty(TYPE, EnumPanelType.Basic));
|
||||
setHardness(2.0F);
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/generators"));
|
||||
this.setDefaultState(this.getStateFromMeta(0));
|
||||
|
||||
for (int i = 0; i < panes.length; i++) {
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i).setInvVariant("type=" + panes[i]));
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/generators").setInvVariant("type=" + panes[i]));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[]{TYPE});
|
||||
}
|
||||
|
@ -74,21 +86,31 @@ public class BlockSolarPanel extends BaseTileBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
EnumPanelType type = (EnumPanelType) state.getValue(TYPE);
|
||||
|
||||
return type.getID();
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileSolarPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileSolarPanel();
|
||||
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)));
|
||||
}
|
||||
@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()));
|
||||
System.out.println((new ItemStack(this, 1, panelType.ordinal())) + "daad");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package techreborn.tiles.generator;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -32,6 +33,7 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
|
||||
import techreborn.blocks.generator.solarpanel.EnumPanelType;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
|
@ -44,59 +46,50 @@ import java.util.List;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxOutput", comment = "Solar Panel Max Output (Value in EU)")
|
||||
public static int maxOutput = 32;
|
||||
@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;
|
||||
// @ConfigRegistry(config = "machines", category = "solar_panel", key = "SolarPanelMaxOutput", comment = "Solar Panel Max Output (Value in EU)")
|
||||
// public static int maxOutput = 32;
|
||||
// @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;
|
||||
|
||||
public TileSolarPanel() {
|
||||
super();
|
||||
IBlockState panelType = world.getBlockState(pos);
|
||||
System.out.println(panelType + " Dimmer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (!this.world.isRemote) {
|
||||
if (this.world.getTotalWorldTime() % 60 == 0) {
|
||||
this.shouldMakePower = this.isSunOut();
|
||||
|
||||
}
|
||||
if (this.shouldMakePower) {
|
||||
this.powerToAdd = energyPerTick;
|
||||
this.addEnergy(this.powerToAdd);
|
||||
} else {
|
||||
this.powerToAdd = 0;
|
||||
}
|
||||
|
||||
}
|
||||
// super.update();
|
||||
// if (!this.world.isRemote) {
|
||||
// if (this.world.getTotalWorldTime() % 60 == 0) {
|
||||
// this.shouldMakePower = this.isSunOut();
|
||||
//
|
||||
// }
|
||||
// if (this.shouldMakePower) {
|
||||
// this.powerToAdd = energyPerTick;
|
||||
// this.addEnergy(this.powerToAdd);
|
||||
// } else {
|
||||
// this.powerToAdd = 0;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
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() {
|
||||
return this.world.canBlockSeeSky(this.pos.up()) && !this.world.isRaining() && !this.world.isThundering()
|
||||
&& this.world.isDaytime();
|
||||
}
|
||||
// public boolean isSunOut() {
|
||||
// return this.world.canBlockSeeSky(this.pos.up()) && !this.world.isRaining() && !this.world.isThundering()
|
||||
// && this.world.isDaytime();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,14 +104,16 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return maxOutput;
|
||||
return 200;
|
||||
}
|
||||
|
||||
private EnumPanelType getPanelType() {
|
||||
return world.getBlockState(pos).getValue(BlockSolarPanel.TYPE);
|
||||
}
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer p0) {
|
||||
return new ItemStack(ModBlocks.SOLAR_PANEL);
|
||||
|
|
|
@ -1,60 +1,57 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {},
|
||||
"transform": "forge:default-block",
|
||||
"model": "cube_bottom_top"
|
||||
},
|
||||
"variants": {
|
||||
"inventory": {
|
||||
"transform": "forge:default-block",
|
||||
"model": "cube_bottom_top",
|
||||
"textures": {
|
||||
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"basic": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/solar_panel_side_off",
|
||||
"top": "techreborn:blocks/machines/generators/solar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
||||
}
|
||||
},
|
||||
"hybrid": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/solar_panel_side_off",
|
||||
"top": "techreborn:blocks/machines/generators/solar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
||||
}
|
||||
},
|
||||
"advanced": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/solar_panel_side_off",
|
||||
"top": "techreborn:blocks/machines/generators/solar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
||||
}
|
||||
},
|
||||
"ultimate": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/solar_panel_side_off",
|
||||
"top": "techreborn:blocks/machines/generators/solar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
||||
}
|
||||
},
|
||||
"quantum": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/solar_panel_side_off",
|
||||
"top": "techreborn:blocks/machines/generators/solar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/solar_panel_side_off"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"textures": {},
|
||||
"transform": "forge:default-block",
|
||||
"model": "cube_bottom_top"
|
||||
},
|
||||
"variants": {
|
||||
"inventory": {
|
||||
"transform": "forge:default-block",
|
||||
"model": "orientable",
|
||||
"textures": {}
|
||||
},
|
||||
"type": {
|
||||
"basic": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/panels/basicsolar_panel_side",
|
||||
"top": "techreborn:blocks/machines/generators/panels/basicsolar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/panels/basicsolar_panel_side"
|
||||
}
|
||||
},
|
||||
"hybrid": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/panels/hybridsolar_panel_side",
|
||||
"top": "techreborn:blocks/machines/generators/panels/hybridsolar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/panels/hybridsolar_panel_side"
|
||||
}
|
||||
},
|
||||
"advanced": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/panels/advancedsolar_panel_side",
|
||||
"top": "techreborn:blocks/machines/generators/panels/advancedsolar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/panels/advancedsolar_panel_side"
|
||||
}
|
||||
},
|
||||
"ultimate": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/panels/ultimatesolar_panel_side",
|
||||
"top": "techreborn:blocks/machines/generators/panels/ultimatesolar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/panels/ultimatesolar_panel_side"
|
||||
}
|
||||
},
|
||||
"quantum": {
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/generators/panels/quantumsolar_panel_side",
|
||||
"top": "techreborn:blocks/machines/generators/panels/quantumsolar_panel_top",
|
||||
"down": "techreborn:blocks/machines/generators/generator_bottom",
|
||||
"side": "techreborn:blocks/machines/generators/panels/quantumsolar_panel_side"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 813 B After Width: | Height: | Size: 813 B |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 638 B After Width: | Height: | Size: 638 B |
After Width: | Height: | Size: 674 B |
After Width: | Height: | Size: 813 B |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 16 KiB |