Large handfull of textures.

This commit is contained in:
Modmuss50 2015-11-26 21:48:30 +00:00
parent d452ed5bfb
commit 285176e171
10 changed files with 153 additions and 6 deletions

View file

@ -342,6 +342,19 @@ public abstract class BlockMachineBase extends BaseTileBlock implements IBlockTe
}
return rotationTexture.getSide();
}
if(this instanceof IAdvancedRotationTexture){
IAdvancedRotationTexture advancedRotationTexture = (IAdvancedRotationTexture) this;
if(getFacing(blockState) == facing){
return advancedRotationTexture.getFront(isActive(blockState));
}
if(facing == EnumFacing.UP){
return advancedRotationTexture.getTop(isActive(blockState));
}
if(facing == EnumFacing.DOWN){
return advancedRotationTexture.getBottom(isActive(blockState));
}
return advancedRotationTexture.getSide(isActive(blockState));
}
return "techreborn:blocks/machine/machine_side";
}

View file

@ -2,19 +2,25 @@ package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.api.IBlockTextureProvider;
import reborncore.common.BaseBlock;
import techreborn.client.TechRebornCreativeTab;
import techreborn.init.ModBlocks;
import java.security.InvalidParameterException;
import java.util.List;
public class BlockMachineFrame extends Block {
public class BlockMachineFrame extends BaseBlock implements IBlockTextureProvider {
public PropertyInteger METADATA;
public static ItemStack getFrameByName(String name, int count) {
for (int i = 0; i < types.length; i++) {
@ -34,6 +40,7 @@ public class BlockMachineFrame extends Block {
setUnlocalizedName("techreborn.machineFrame");
setCreativeTab(TechRebornCreativeTab.instance);
setHardness(1f);
this.setDefaultState(this.blockState.getBaseState().withProperty(METADATA, 0));
}
@Override
@ -49,4 +56,30 @@ public class BlockMachineFrame extends Block {
public int damageDropped(IBlockState state) {
return super.damageDropped(state);
}
@Override
public String getTextureName(IBlockState blockState, EnumFacing facing) {
return "techreborn:blocks/machine/" + types[getMetaFromState(blockState)] + "_machine_block";
}
@Override
public int amoutOfVariants() {
return types.length;
}
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(METADATA, meta);
}
@Override
public int getMetaFromState(IBlockState state) {
return (Integer) state.getValue(METADATA);
}
protected BlockState createBlockState() {
METADATA = PropertyInteger.create("Type", 0, types.length);
return new BlockState(this, METADATA);
}
}

View file

@ -0,0 +1,13 @@
package techreborn.blocks;
public interface IAdvancedRotationTexture {
String getFront(boolean isActive);
String getSide(boolean isActive);
String getTop(boolean isActive);
String getBottom(boolean isActive);
}

View file

@ -41,7 +41,7 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase implements IRo
@Override
public String getFrontOn() {
return prefix + "techreborn:machine/industrial_electrolyzer_front_on";
return prefix + "industrial_electrolyzer_front_on";
}
@Override

View file

@ -7,10 +7,11 @@ import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import techreborn.Core;
import techreborn.blocks.BlockMachineBase;
import techreborn.blocks.IRotationTexture;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileIndustrialSawmill;
public class BlockIndustrialSawmill extends BlockMachineBase {
public class BlockIndustrialSawmill extends BlockMachineBase implements IRotationTexture {
public BlockIndustrialSawmill(Material material) {
super(material);
@ -34,5 +35,32 @@ public class BlockIndustrialSawmill extends BlockMachineBase {
return true;
}
private final String prefix = "techreborn:/blocks/machine/";
@Override
public String getFrontOff() {
return prefix + "industrial_sawmill_front_off";
}
@Override
public String getFrontOn() {
return prefix + "industrial_sawmill_front_on";
}
@Override
public String getSide() {
return prefix + "advanced_machine_side";
}
@Override
public String getTop() {
return prefix + "advanced_machine_side";
}
@Override
public String getBottom() {
return prefix + "advanced_machine_side";
}
}

View file

@ -6,10 +6,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import techreborn.Core;
import techreborn.blocks.BlockMachineBase;
import techreborn.blocks.IAdvancedRotationTexture;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileMatterFabricator;
public class BlockMatterFabricator extends BlockMachineBase {
public class BlockMatterFabricator extends BlockMachineBase implements IAdvancedRotationTexture {
public BlockMatterFabricator(Material material) {
@ -31,10 +32,30 @@ public class BlockMatterFabricator extends BlockMachineBase {
return true;
}
private final String prefix = "techreborn:/blocks/machine/";
@Override
public boolean isAdvanced() {
return true;
}
@Override
public String getFront(boolean isActive) {
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
}
@Override
public String getSide(boolean isActive) {
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
}
@Override
public String getTop(boolean isActive) {
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
}
@Override
public String getBottom(boolean isActive) {
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
}
}

View file

@ -6,10 +6,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import techreborn.Core;
import techreborn.blocks.BlockMachineBase;
import techreborn.blocks.IAdvancedRotationTexture;
import techreborn.client.GuiHandler;
import techreborn.tiles.TileRollingMachine;
public class BlockRollingMachine extends BlockMachineBase {
public class BlockRollingMachine extends BlockMachineBase implements IAdvancedRotationTexture {
@ -32,5 +33,25 @@ public class BlockRollingMachine extends BlockMachineBase {
return true;
}
private final String prefix = "techreborn:/blocks/machine/";
@Override
public String getFront(boolean isActive) {
return isActive ? prefix + "rolling_machine_side_on" : prefix + "rolling_machine_side_off";
}
@Override
public String getSide(boolean isActive) {
return prefix + "machine_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "machine_top";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "machine_bottom";
}
}

View file

@ -4,9 +4,12 @@ import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBucket;
import reborncore.api.IItemTexture;
import reborncore.api.TextureRegistry;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo;
public class ItemFluidbucket extends ItemBucket {
public class ItemFluidbucket extends ItemBucket implements IItemTexture {
private String iconName;
public ItemFluidbucket(Block block) {
@ -14,6 +17,7 @@ public class ItemFluidbucket extends ItemBucket {
setContainerItem(Items.bucket);
setCreativeTab(TechRebornCreativeTabMisc.instance);
setUnlocalizedName("techreborn.fluidbucket");
TextureRegistry.registerItem(this);
}
@Override
@ -22,5 +26,19 @@ public class ItemFluidbucket extends ItemBucket {
return super.setUnlocalizedName(par1Str);
}
@Override
public String getTextureName(int damage) {
return ModInfo.MOD_ID + ":items/bucket/" + iconName;
}
@Override
public int getMaxMeta() {
return 1;
}
@Override
public String getModID() {
return ModInfo.MOD_ID;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B