-Added colored Lamps
|
@ -0,0 +1,169 @@
|
|||
package ellpeck.actuallyadditions.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.metalists.TheColoredLampColors;
|
||||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockColoredLamp extends Block implements INameableItem{
|
||||
|
||||
public static TheColoredLampColors[] allLampTypes = TheColoredLampColors.values();
|
||||
|
||||
private IIcon[] textures = new IIcon[allLampTypes.length];
|
||||
|
||||
private boolean isOn;
|
||||
|
||||
public BlockColoredLamp(boolean isOn){
|
||||
super(Material.redstoneLight);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setHardness(0.5F);
|
||||
this.isOn = isOn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z){
|
||||
return this.isOn ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
|
||||
//Turning On
|
||||
if(player.isSneaking()){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn, world.getBlockMetadata(x, y, z), 2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Changing Colors
|
||||
int[] oreIDs = OreDictionary.getOreIDs(player.getCurrentEquippedItem());
|
||||
if(oreIDs.length > 0){
|
||||
for(int oreID : oreIDs){
|
||||
String name = OreDictionary.getOreName(oreID);
|
||||
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
||||
if(color != null){
|
||||
if(world.getBlockMetadata(x, y, z) != color.ordinal()){
|
||||
if(!world.isRemote){
|
||||
world.setBlockMetadataWithNotify(x, y, z, color.ordinal(), 2);
|
||||
if(!player.capabilities.isCreativeMode) player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return this.isOn ? "blockColoredLampOn" : "blockColoredLamp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return meta >= allLampTypes.length ? null : textures[meta];
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list){
|
||||
for (int j = 0; j < allLampTypes.length; j++){
|
||||
list.add(new ItemStack(item, 1, j));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random rand, int par3){
|
||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z){
|
||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createStackedBlock(int meta){
|
||||
return new ItemStack(InitBlocks.blockColoredLamp, 1, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta){
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
for(int i = 0; i < allLampTypes.length; i++){
|
||||
this.textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + ((INameableItem)InitBlocks.blockColoredLamp).getName() + allLampTypes[i].name + (isOn ? "On" : ""));
|
||||
}
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlock{
|
||||
|
||||
private Block theBlock;
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
super(block);
|
||||
this.theBlock = block;
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return InitBlocks.blockColoredLamp.getUnlocalizedName() + allLampTypes[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(InitBlocks.blockColoredLamp, list, 2, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack){
|
||||
if(stack.getItemDamage() >= allLampTypes.length) return null;
|
||||
return StatCollector.translateToLocal(this.getUnlocalizedName(stack) + ".name") + (((BlockColoredLamp)this.theBlock).isOn ? " (" + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".onSuffix.desc") + ")" : "");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,9 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
@ -36,6 +38,11 @@ public class BlockPlant extends BlockCrops implements INameableItem{
|
|||
this.addDropAmount = addDropAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z){
|
||||
return EnumPlantType.Crop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(int meta, int fortune, Random random){
|
||||
return meta >= 7 ? random.nextInt(addDropAmount)+minDropAmount : super.quantityDropped(meta, fortune, random);
|
||||
|
|
|
@ -73,7 +73,10 @@ public class InitBlocks{
|
|||
public static Block blockTestifiBucksGreenStairs;
|
||||
public static Block blockTestifiBucksWhiteStairs;
|
||||
public static Block blockTestifiBucksGreenSlab;
|
||||
public static Block blockTestifibucksWhiteSlab;
|
||||
public static Block blockTestifiBucksWhiteSlab;
|
||||
|
||||
public static Block blockColoredLamp;
|
||||
public static Block blockColoredLampOn;
|
||||
|
||||
public static void init(){
|
||||
Util.logInfo("Initializing Blocks...");
|
||||
|
@ -88,8 +91,13 @@ public class InitBlocks{
|
|||
BlockUtil.register(blockTestifiBucksWhiteStairs, BlockStair.TheItemBlock.class);
|
||||
blockTestifiBucksGreenSlab = new BlockSlabs("blockTestifiBucksGreenSlab", blockTestifiBucksGreenWall);
|
||||
BlockUtil.register(blockTestifiBucksGreenSlab, BlockSlabs.TheItemBlock.class);
|
||||
blockTestifibucksWhiteSlab = new BlockSlabs("blockTestifibucksWhiteSlab", blockTestifiBucksWhiteWall);
|
||||
BlockUtil.register(blockTestifibucksWhiteSlab, BlockSlabs.TheItemBlock.class);
|
||||
blockTestifiBucksWhiteSlab = new BlockSlabs("blockTestifiBucksWhiteSlab", blockTestifiBucksWhiteWall);
|
||||
BlockUtil.register(blockTestifiBucksWhiteSlab, BlockSlabs.TheItemBlock.class);
|
||||
|
||||
blockColoredLamp = new BlockColoredLamp(false);
|
||||
BlockUtil.register(blockColoredLamp, BlockColoredLamp.TheItemBlock.class, BlockColoredLamp.allLampTypes);
|
||||
blockColoredLampOn = new BlockColoredLamp(true);
|
||||
BlockUtil.register(blockColoredLampOn, BlockColoredLamp.TheItemBlock.class, false, BlockColoredLamp.allLampTypes);
|
||||
|
||||
blockEnergizer = new BlockEnergizer(true);
|
||||
BlockUtil.register(blockEnergizer, BlockEnergizer.TheItemBlock.class);
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package ellpeck.actuallyadditions.blocks.metalists;
|
||||
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
|
||||
public enum TheColoredLampColors implements INameableItem{
|
||||
|
||||
WHITE("White"),
|
||||
ORANGE("Orange"),
|
||||
MAGENTA("Magenta"),
|
||||
LIGHT_BLUE("LightBlue"),
|
||||
YELLOW("Yellow"),
|
||||
LIME("Lime"),
|
||||
PINK("Pink"),
|
||||
GRAY("Gray"),
|
||||
LIGHT_GRAY("LightGray"),
|
||||
CYAN("Cyan"),
|
||||
PURPLE("Purple"),
|
||||
BLUE("Blue"),
|
||||
BROWN("Brown"),
|
||||
GREEN("Green"),
|
||||
RED("Red"),
|
||||
BLACK("Black");
|
||||
|
||||
public String name;
|
||||
|
||||
TheColoredLampColors(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return "blockColoredLamp" + this.getName();
|
||||
}
|
||||
|
||||
public static TheColoredLampColors getColorFromDyeName(String color){
|
||||
String actualName = color.substring(3);
|
||||
for(int i = 0; i < values().length; i++){
|
||||
if(values()[i].getName().equals(actualName)) return values()[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -69,7 +69,8 @@ public class CreativeTab extends CreativeTabs{
|
|||
add(InitBlocks.blockTestifiBucksGreenStairs);
|
||||
add(InitBlocks.blockTestifiBucksWhiteStairs);
|
||||
add(InitBlocks.blockTestifiBucksGreenSlab);
|
||||
add(InitBlocks.blockTestifibucksWhiteSlab);
|
||||
add(InitBlocks.blockTestifiBucksWhiteSlab);
|
||||
add(InitBlocks.blockColoredLamp);
|
||||
|
||||
add(InitItems.itemDrill);
|
||||
add(InitItems.itemDrillUpgradeSpeed);
|
||||
|
|
|
@ -7,8 +7,7 @@ import ellpeck.actuallyadditions.achievement.InitAchievements;
|
|||
public class PickupEvent{
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCraftedEvent(PlayerEvent.ItemPickupEvent event){
|
||||
public void onPickupEvent(PlayerEvent.ItemPickupEvent event){
|
||||
CraftEvent.checkAchievements(event.pickedUp.getEntityItem(), event, InitAchievements.PICKUP_ACH);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -232,8 +232,7 @@ public class GuiInputter extends GuiContainer{
|
|||
this.setVariable(this.fieldPullStart, 2);
|
||||
this.setVariable(this.fieldPullEnd, 3);
|
||||
}
|
||||
else
|
||||
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
|
||||
else PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
|
||||
}
|
||||
|
||||
public static class SmallerButton extends GuiButton{
|
||||
|
|
|
@ -39,6 +39,7 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{
|
|||
API.hideItem(new ItemStack(InitBlocks.blockFlax));
|
||||
API.hideItem(new ItemStack(InitBlocks.blockCoffee));
|
||||
API.hideItem(new ItemStack(InitBlocks.blockWildPlant, 1, Util.WILDCARD));
|
||||
API.hideItem(new ItemStack(InitBlocks.blockColoredLampOn, 1, Util.WILDCARD));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,7 +44,7 @@ public class BlockUtil{
|
|||
public static final ArrayList<Block> wailaRegisterList = new ArrayList<Block>();
|
||||
|
||||
public static void register(Block block, Class<? extends ItemBlock> itemBlock, boolean addTab, Enum[] list){
|
||||
if(addTab) block.setCreativeTab(CreativeTab.instance);
|
||||
block.setCreativeTab(addTab ? CreativeTab.instance : null);
|
||||
block.setBlockName(createUnlocalizedName(block));
|
||||
GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName());
|
||||
if(list != null){
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ItemUtil{
|
|||
}
|
||||
|
||||
public static void register(Item item, boolean addTab, Enum[] list){
|
||||
if(addTab) item.setCreativeTab(CreativeTab.instance);
|
||||
item.setCreativeTab(addTab ? CreativeTab.instance : null);
|
||||
item.setUnlocalizedName(createUnlocalizedName(item));
|
||||
GameRegistry.registerItem(item, ((INameableItem)item).getName());
|
||||
if(list != null){
|
||||
|
|
|
@ -61,6 +61,26 @@ tooltip.actuallyadditions.itemBattery.desc=Stores RF! Charge in an Energizer! Di
|
|||
tile.actuallyadditions.blockCoalGenerator.name=Coal Generator
|
||||
tooltip.actuallyadditions.blockCoalGenerator.desc=Produces Energy from Coal and other flammable Materials
|
||||
|
||||
tooltip.actuallyadditions.blockColoredLamp.desc.1=Sneak-Right-Click to turn me on!
|
||||
tooltip.actuallyadditions.blockColoredLamp.desc.2=Right-Click me with a Dye to dye me!
|
||||
|
||||
tile.actuallyadditions.blockColoredLampWhite.name=White Lamp
|
||||
tile.actuallyadditions.blockColoredLampOrange.name=Orange Lamp
|
||||
tile.actuallyadditions.blockColoredLampMagenta.name=Magenta Lamp
|
||||
tile.actuallyadditions.blockColoredLampYellow.name=Yellow Lamp
|
||||
tile.actuallyadditions.blockColoredLampLightBlue.name=Light Blue Lamp
|
||||
tile.actuallyadditions.blockColoredLampBlue.name=Blue Lamp
|
||||
tile.actuallyadditions.blockColoredLampGray.name=Gray Lamp
|
||||
tile.actuallyadditions.blockColoredLampLightGray.name=Light Gray Lamp
|
||||
tile.actuallyadditions.blockColoredLampGreen.name=Green Lamp
|
||||
tile.actuallyadditions.blockColoredLampBlack.name=Black Lamp
|
||||
tile.actuallyadditions.blockColoredLampBrown.name=Brown Lamp
|
||||
tile.actuallyadditions.blockColoredLampRed.name=Red Lamp
|
||||
tile.actuallyadditions.blockColoredLampLime.name=Lime Lamp
|
||||
tile.actuallyadditions.blockColoredLampPink.name=Pink Lamp
|
||||
tile.actuallyadditions.blockColoredLampCyan.name=Cyan Lamp
|
||||
tile.actuallyadditions.blockColoredLampPurple.name=Purple Lamp
|
||||
|
||||
item.actuallyadditions.itemBucketCanolaOil.name=Canola Oil Bucket
|
||||
tooltip.actuallyadditions.itemBucketCanolaOil.desc=A Bucket filled with Canola Oil
|
||||
item.actuallyadditions.itemBucketOil.name=Oil Bucket
|
||||
|
@ -144,6 +164,20 @@ tooltip.actuallyadditions.blockWildRice.desc=Grows in the Wild... Gets you Rice
|
|||
tooltip.actuallyadditions.blockWildCoffee.desc=Grows in the Wild... Gets you Coffee Seeds!
|
||||
tooltip.actuallyadditions.blockWildFlax.desc=Grows in the Wild... Gets you Flax Seeds!
|
||||
|
||||
tile.actuallyadditions.blockTestifiBucksGreenWall.name=Green TestifiBucks Wall
|
||||
tile.actuallyadditions.blockTestifiBucksWhiteWall.name=White TestifiBucks Wall
|
||||
tile.actuallyadditions.blockTestifiBucksGreenStairs.name=Green TestifiBucks Stairs
|
||||
tile.actuallyadditions.blockTestifiBucksWhiteStairs.name=White TestifiBucks Stairs
|
||||
tile.actuallyadditions.blockTestifiBucksGreenSlab.name=Green TestifiBucks Slab
|
||||
tile.actuallyadditions.blockTestifiBucksWhiteSlab.name=White TestifiBucks Slab
|
||||
|
||||
tooltip.actuallyadditions.blockTestifiBucksGreenWall.desc=A Green Wall used in a TestifiBucks
|
||||
tooltip.actuallyadditions.blockTestifiBucksWhiteWall.desc=A White Wall used in a TestifiBucks
|
||||
tooltip.actuallyadditions.blockTestifiBucksGreenStairs.desc=A Green Stair used in a TestifiBucks
|
||||
tooltip.actuallyadditions.blockTestifiBucksWhiteStairs.desc=A White Stair used in a TestifiBucks
|
||||
tooltip.actuallyadditions.blockTestifiBucksGreenSlab.desc=A Green Slab used in a TestifiBucks
|
||||
tooltip.actuallyadditions.blockTestifiBucksWhiteSlab.desc=A White Slab used in a TestifiBucks
|
||||
|
||||
item.actuallyadditions.itemCanolaSeed.name=Canola Seeds
|
||||
tooltip.actuallyadditions.itemCanolaSeed.desc=Grows on Farmland! Makes Canola!
|
||||
item.actuallyadditions.itemMiscCanola.name=Canola
|
||||
|
@ -219,6 +253,8 @@ tooltip.actuallyadditions.itemDrillUpgrade.desc=Sneak-Right-Click the Drill to a
|
|||
tile.actuallyadditions.blockMiscEnderCasing.name=Ender Casing
|
||||
tooltip.actuallyadditions.blockMiscEnderCasing.desc=Extremely sturdy casing, used for crafting
|
||||
|
||||
tooltip.actuallyadditions.onSuffix.desc=On
|
||||
|
||||
tooltip.actuallyadditions.phantom.connected.desc=<Block connected!>
|
||||
tooltip.actuallyadditions.phantom.stored.desc=<Block stored to this Connector!>
|
||||
tooltip.actuallyadditions.phantom.unbound.desc=The Connection was cleared!
|
||||
|
|
After Width: | Height: | Size: 306 B |
After Width: | Height: | Size: 361 B |
After Width: | Height: | Size: 533 B |
After Width: | Height: | Size: 623 B |
After Width: | Height: | Size: 445 B |
After Width: | Height: | Size: 481 B |
After Width: | Height: | Size: 477 B |
After Width: | Height: | Size: 554 B |
After Width: | Height: | Size: 372 B |
After Width: | Height: | Size: 459 B |
After Width: | Height: | Size: 422 B |
After Width: | Height: | Size: 464 B |
After Width: | Height: | Size: 436 B |
After Width: | Height: | Size: 492 B |
After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 507 B |
After Width: | Height: | Size: 558 B |
After Width: | Height: | Size: 635 B |
After Width: | Height: | Size: 540 B |
After Width: | Height: | Size: 625 B |
After Width: | Height: | Size: 484 B |
After Width: | Height: | Size: 567 B |
After Width: | Height: | Size: 402 B |
After Width: | Height: | Size: 478 B |
After Width: | Height: | Size: 544 B |
After Width: | Height: | Size: 615 B |
After Width: | Height: | Size: 380 B |
After Width: | Height: | Size: 453 B |
After Width: | Height: | Size: 439 B |
After Width: | Height: | Size: 569 B |
After Width: | Height: | Size: 527 B |
After Width: | Height: | Size: 595 B |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 772 B |
After Width: | Height: | Size: 794 B |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 756 B |
After Width: | Height: | Size: 794 B |
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 1,
|
||||
"frames": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
|
||||
]
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 515 B |
After Width: | Height: | Size: 413 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 443 B |
After Width: | Height: | Size: 683 B |
After Width: | Height: | Size: 449 B |
After Width: | Height: | Size: 337 B |
After Width: | Height: | Size: 527 B |
After Width: | Height: | Size: 564 B |
After Width: | Height: | Size: 416 B |
After Width: | Height: | Size: 361 B |
After Width: | Height: | Size: 463 B |
After Width: | Height: | Size: 438 B |
After Width: | Height: | Size: 407 B |
After Width: | Height: | Size: 286 B |