mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
parent
ce63aafe3f
commit
0853860810
3 changed files with 37 additions and 13 deletions
|
@ -22,9 +22,13 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockLampPowerer extends BlockBase{
|
public class BlockLampPowerer extends BlockBase{
|
||||||
|
|
||||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
|
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
|
||||||
|
@ -59,20 +63,38 @@ public class BlockLampPowerer extends BlockBase{
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)));
|
BlockPos coords = pos.offset(WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state)));
|
||||||
IBlockState coordsState = world.getBlockState(coords);
|
this.updateLampsAtPos(world, coords, world.isBlockIndirectlyGettingPowered(pos) > 0, new ArrayList<BlockPos>());
|
||||||
if(coordsState.getBlock() instanceof BlockColoredLamp){
|
}
|
||||||
int meta = coordsState.getBlock().getMetaFromState(coordsState);
|
}
|
||||||
if(world.isBlockIndirectlyGettingPowered(pos) > 0){
|
|
||||||
if(!((BlockColoredLamp)coordsState.getBlock()).isOn){
|
private void updateLampsAtPos(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready){
|
||||||
world.setBlockState(coords, InitBlocks.blockColoredLampOn.getStateFromMeta(meta), 2);
|
IBlockState state = world.getBlockState(pos);
|
||||||
}
|
Block block = state.getBlock();
|
||||||
|
if(block instanceof BlockColoredLamp){
|
||||||
|
boolean isOn = ((BlockColoredLamp)block).isOn;
|
||||||
|
int meta = block.getMetaFromState(state);
|
||||||
|
if(powered){
|
||||||
|
if(!isOn){
|
||||||
|
world.setBlockState(pos, InitBlocks.blockColoredLampOn.getStateFromMeta(meta), 2);
|
||||||
}
|
}
|
||||||
else{
|
}
|
||||||
if(((BlockColoredLamp)coordsState.getBlock()).isOn){
|
else{
|
||||||
world.setBlockState(coords, InitBlocks.blockColoredLamp.getStateFromMeta(meta), 2);
|
if(isOn){
|
||||||
}
|
world.setBlockState(pos, InitBlocks.blockColoredLamp.getStateFromMeta(meta), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateSurrounding(world, pos, powered, updatedAlready);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSurrounding(World world, BlockPos pos, boolean powered, List<BlockPos> updatedAlready){
|
||||||
|
for(EnumFacing side : EnumFacing.values()){
|
||||||
|
BlockPos offset = pos.offset(side);
|
||||||
|
if(!updatedAlready.contains(offset)){
|
||||||
|
updatedAlready.add(pos);
|
||||||
|
this.updateLampsAtPos(world, offset, powered, updatedAlready);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,8 @@ public final class InitBooklet{
|
||||||
new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText());
|
new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText());
|
||||||
ArrayList<BookletPage> lampPages = new ArrayList<BookletPage>();
|
ArrayList<BookletPage> lampPages = new ArrayList<BookletPage>();
|
||||||
lampPages.add(new PageTextOnly(lampPages.size()+1));
|
lampPages.add(new PageTextOnly(lampPages.size()+1));
|
||||||
lampPages.add(new PageCrafting(lampPages.size()+1, BlockCrafting.recipePowerer).setNoText());
|
lampPages.add(new PageTextOnly(lampPages.size()+1));
|
||||||
|
lampPages.add(new PageCrafting(lampPages.size()+1, BlockCrafting.recipePowerer).setNoText().setPageStacksWildcard());
|
||||||
for(IRecipe recipe : BlockCrafting.RECIPES_LAMPS){
|
for(IRecipe recipe : BlockCrafting.RECIPES_LAMPS){
|
||||||
lampPages.add(new PageCrafting(lampPages.size()+1, recipe).setNoText());
|
lampPages.add(new PageCrafting(lampPages.size()+1, recipe).setNoText());
|
||||||
}
|
}
|
||||||
|
|
|
@ -752,7 +752,8 @@ booklet.actuallyadditions.chapter.coalStuff.name=Coal Stuff
|
||||||
booklet.actuallyadditions.chapter.coalStuff.text.1=Sometimes your <item>Coal<r> just <imp>burns for too long or too short<r>, you know what I mean? <n>For that, you can now craft <item>Tiny Coal<r>, <item>Tiny Charcoal<r> and <item>Blocks of Charcoal<r> for using them in a furnace. <n>While the <item>Block of Charcoal<r> burns for as long as a <item>Block of Coal<r>, the <item>Tiny Coal<r> and <item>Tiny Charcoal<r> will burn for <imp>one eighth of a piece of coal<r>, meaning it will <imp>smelt one item in a normal furnace<r>.
|
booklet.actuallyadditions.chapter.coalStuff.text.1=Sometimes your <item>Coal<r> just <imp>burns for too long or too short<r>, you know what I mean? <n>For that, you can now craft <item>Tiny Coal<r>, <item>Tiny Charcoal<r> and <item>Blocks of Charcoal<r> for using them in a furnace. <n>While the <item>Block of Charcoal<r> burns for as long as a <item>Block of Coal<r>, the <item>Tiny Coal<r> and <item>Tiny Charcoal<r> will burn for <imp>one eighth of a piece of coal<r>, meaning it will <imp>smelt one item in a normal furnace<r>.
|
||||||
|
|
||||||
booklet.actuallyadditions.chapter.lamps.name=Lamps
|
booklet.actuallyadditions.chapter.lamps.name=Lamps
|
||||||
booklet.actuallyadditions.chapter.lamps.text.1=<item>Lamps<r> are a block providing lots of light, similar to the mystic Glowstone or Torches, but they can be <imp>dyed with all of the 16 different colors<r> either by <imp>crafting them<r> or by placing them on the ground and <imp>right-clicking them with a piece of dye<r>. <n>When <imp>right-clicking<r> them with an empty hand, they will <imp>turn on and off<r>. If you want them, however, to be toggled using <item>Redstone<r> Power, just place a <item>Lamp Controller<r> next to one.
|
booklet.actuallyadditions.chapter.lamps.text.1=<item>Lamps<r> are a block providing lots of light, similar to the mystic Glowstone or Torches, but they can be <imp>dyed with all of the 16 different colors<r> either by <imp>crafting them<r> or by placing them on the ground and <imp>right-clicking them with a piece of dye<r>. <n>When <imp>right-clicking<r> them with an empty hand, they will <imp>turn on and off<r>.
|
||||||
|
booklet.actuallyadditions.chapter.lamps.text.2=There is a way to toggle them with <imp>Redstone<r>, however. If you place a <item>Lamp Controller<r> facing into one and give it a <imp>redstone signal<r>, it will turn the lamp in front of it on and off. <n>The thing that makes this very expandable, though, is that it also <imp>toggles every lamp adjacent to that lamp<r> and every other lamp that gets touched. <n>That means you can have a huge field of lamps and toggle them all with <imp>just one<r> <item>Lamp Controller<r>.
|
||||||
|
|
||||||
booklet.actuallyadditions.chapter.treasureChest.name=Treasure Chests
|
booklet.actuallyadditions.chapter.treasureChest.name=Treasure Chests
|
||||||
booklet.actuallyadditions.chapter.treasureChest.text.1=A <item>Treasure Chest<r> found underwater.
|
booklet.actuallyadditions.chapter.treasureChest.text.1=A <item>Treasure Chest<r> found underwater.
|
||||||
|
|
Loading…
Reference in a new issue