Fixed itemBlock rendering. TOP\Waila are still an issue
This commit is contained in:
parent
047507f4fc
commit
19ccbd681d
6 changed files with 94 additions and 42 deletions
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
package techreborn.blocks.generator.solarpanel;
|
package techreborn.blocks.generator.solarpanel;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
|
@ -50,26 +49,23 @@ import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
import techreborn.tiles.generator.TileSolarPanel;
|
import techreborn.tiles.generator.TileSolarPanel;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 25/02/2016.
|
* Created by modmuss50 on 25/02/2016.
|
||||||
*/
|
*/
|
||||||
public class BlockSolarPanel extends BaseTileBlock {
|
public class BlockSolarPanel extends BaseTileBlock {
|
||||||
public static final String[] panes = new String[] {
|
public static final String[] panes = new String[] {
|
||||||
"Basic", "Hybrid", "Advanced", "Ultimate", "Quantum"};
|
"basic", "hybrid", "advanced", "ultimate", "quantum"};
|
||||||
public static final IProperty<EnumPanelType> TYPE = PropertyEnum.create("type", EnumPanelType.class);
|
|
||||||
public static PropertyBool ACTIVE = PropertyBool.create("active");
|
public static PropertyBool ACTIVE = PropertyBool.create("active");
|
||||||
private static final List<String> paneList = Lists.newArrayList(panes);
|
public static final IProperty<EnumPanelType> TYPE = PropertyEnum.create("type", EnumPanelType.class);
|
||||||
|
|
||||||
public BlockSolarPanel() {
|
public BlockSolarPanel() {
|
||||||
super(Material.IRON);
|
super(Material.IRON);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
this.setDefaultState(this.getBlockState().getBaseState().withProperty(TYPE, EnumPanelType.Basic).withProperty(ACTIVE, false));
|
this.setDefaultState(this.getBlockState().getBaseState().withProperty(ACTIVE, false).withProperty(TYPE, EnumPanelType.Basic));
|
||||||
setHardness(2.0F);
|
setHardness(2.0F);
|
||||||
this.setDefaultState(this.getStateFromMeta(0));
|
//this.setDefaultState(this.getStateFromMeta(0));
|
||||||
for (int i = 0; i < panes.length; i++) {
|
for (int i = 0; i < panes.length; i++) {
|
||||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/generators").setInvVariant("type=" + panes[i] + ",active=false"));
|
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/generators").setInvVariant("active=false,type=" + panes[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +76,7 @@ public class BlockSolarPanel extends BaseTileBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockState() {
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, TYPE, ACTIVE);
|
return new BlockStateContainer(this, ACTIVE, TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -90,7 +86,7 @@ public class BlockSolarPanel extends BaseTileBlock {
|
||||||
active = true;
|
active = true;
|
||||||
meta -= EnumPanelType.values().length;
|
meta -= EnumPanelType.values().length;
|
||||||
}
|
}
|
||||||
return getDefaultState().withProperty(TYPE, EnumPanelType.values()[meta]).withProperty(ACTIVE, active);
|
return getDefaultState().withProperty(ACTIVE, active).withProperty(TYPE, EnumPanelType.values()[meta]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,3 +1,27 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package techreborn.blocks.generator.solarpanel;
|
||||||
|
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
@ -10,18 +34,13 @@ public enum EnumPanelType implements IStringSerializable {
|
||||||
Ultimate("ultimate", 256, 16, EnumPowerTier.HIGH),
|
Ultimate("ultimate", 256, 16, EnumPowerTier.HIGH),
|
||||||
Quantum("quantum", 1024, 64, EnumPowerTier.EXTREME);
|
Quantum("quantum", 1024, 64, EnumPowerTier.EXTREME);
|
||||||
|
|
||||||
private int ID;
|
|
||||||
private String friendlyName;
|
private String friendlyName;
|
||||||
|
|
||||||
public int generationRateD = 10;
|
|
||||||
// Generation of EU during Day
|
// Generation of EU during Day
|
||||||
|
public int generationRateD = 10;
|
||||||
public int generationRateN = 0;
|
|
||||||
// Generation of EU during Night
|
// Generation of EU during Night
|
||||||
|
public int generationRateN = 0;
|
||||||
public int internalCapacity = 1000;
|
|
||||||
// Internal EU storage of solar panel
|
// Internal EU storage of solar panel
|
||||||
|
public int internalCapacity = 1000;
|
||||||
public EnumPowerTier powerTier;
|
public EnumPowerTier powerTier;
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,5 +56,4 @@ public enum EnumPanelType implements IStringSerializable {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return friendlyName;
|
return friendlyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,7 +35,6 @@ import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import techreborn.blocks.cable.BlockCable;
|
import techreborn.blocks.cable.BlockCable;
|
||||||
import techreborn.blocks.cable.EnumCableType;
|
import techreborn.blocks.cable.EnumCableType;
|
||||||
import techreborn.blocks.generator.solarpanel.EnumPanelType;
|
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.init.ModItems;
|
import techreborn.init.ModItems;
|
||||||
|
@ -176,10 +175,6 @@ public class RegisterItemJsons {
|
||||||
registerBlockstateMultiItem(Item.getItemFromBlock(ModBlocks.CABLE), cableType.ordinal(), cableType.getName().toLowerCase(), "cable_inv");
|
registerBlockstateMultiItem(Item.getItemFromBlock(ModBlocks.CABLE), cableType.ordinal(), cableType.getName().toLowerCase(), "cable_inv");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (EnumPanelType panelType : EnumPanelType.values()) {
|
|
||||||
registerBlockstate(Item.getItemFromBlock(ModBlocks.SOLAR_PANEL), panelType.ordinal(), panelType.getName().toLowerCase() + ",active=false", "blocks/generators/");
|
|
||||||
}
|
|
||||||
|
|
||||||
ModelLoader.setCustomStateMapper(ModBlocks.CABLE, new DefaultStateMapper() {
|
ModelLoader.setCustomStateMapper(ModBlocks.CABLE, new DefaultStateMapper() {
|
||||||
@Override
|
@Override
|
||||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||||
|
|
|
@ -1,19 +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;
|
package techreborn.itemblocks;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlock;
|
import reborncore.common.itemblock.ItemBlockBase;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
|
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class ItemBlockSolarPanel extends ItemBlock {
|
public class ItemBlockSolarPanel extends ItemBlockBase {
|
||||||
|
public ItemBlockSolarPanel(Block block){
|
||||||
public ItemBlockSolarPanel(Block block) {
|
super(ModBlocks.SOLAR_PANEL, ModBlocks.SOLAR_PANEL, BlockSolarPanel.panes);
|
||||||
super(block);
|
|
||||||
setHasSubtypes(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnlocalizedName(ItemStack stack) {
|
|
||||||
return super.getUnlocalizedName() + "." + ModBlocks.SOLAR_PANEL.getStateFromMeta(stack.getItemDamage()).getValue(BlockSolarPanel.TYPE).getName().toLowerCase();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,27 @@
|
||||||
|
/*
|
||||||
|
* 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.utils;
|
package techreborn.utils;
|
||||||
|
|
||||||
import ic2.api.item.ElectricItem;
|
import ic2.api.item.ElectricItem;
|
||||||
|
|
|
@ -3,17 +3,19 @@
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"textures": {
|
"textures": {
|
||||||
"particle": "techreborn:blocks/machines/generators/generator_bottom",
|
"particle": "techreborn:blocks/machines/generators/generator_bottom",
|
||||||
"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",
|
"transform": "forge:default-block",
|
||||||
"model": "cube_bottom_top"
|
"model": "cube_bottom_top"
|
||||||
},
|
},
|
||||||
"variants": {
|
"variants": {
|
||||||
"inventory": {
|
"inventory": {
|
||||||
"transform": "forge:default-block",
|
"transform": "forge:default-block",
|
||||||
"model": "orientable",
|
"model": "cube_bottom_top",
|
||||||
"textures": {}
|
"textures": {}
|
||||||
},
|
},
|
||||||
|
"normal": [{}],
|
||||||
"active": {
|
"active": {
|
||||||
"true": {
|
"true": {
|
||||||
"textures": {
|
"textures": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue