mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
added the aura detector
This commit is contained in:
parent
fe07d9304e
commit
5dc3a7a83d
9 changed files with 107 additions and 1 deletions
|
@ -0,0 +1,29 @@
|
|||
package de.ellpeck.naturesaura.blocks;
|
||||
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraDetector;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockAuraDetector extends BlockContainerImpl {
|
||||
|
||||
public BlockAuraDetector() {
|
||||
super(Material.ROCK, "aura_detector", TileEntityAuraDetector.class, "aura_detector");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityAuraDetector)
|
||||
return ((TileEntityAuraDetector) tile).redstonePower;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -19,4 +19,5 @@ public final class ModBlocks {
|
|||
public static final Block INFUSED_STONE = new BlockImpl("infused_stone", Material.ROCK).setSoundType(SoundType.STONE).setHardness(1.75F);
|
||||
public static final Block FURNACE_HEATER = new BlockFurnaceHeater();
|
||||
public static final Block POTION_GENERATOR = new BlockPotionGenerator();
|
||||
public static final Block AURA_DETECTOR = new BlockAuraDetector();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import de.ellpeck.naturesaura.aura.chunk.AuraChunk;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class TileEntityAuraDetector extends TileEntityImpl implements ITickable {
|
||||
|
||||
public int redstonePower;
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (!this.world.isRemote && this.world.getTotalWorldTime() % 80 == 0) {
|
||||
int amount = AuraChunk.getAuraInArea(this.world, this.pos, 8);
|
||||
int power = MathHelper.clamp(MathHelper.ceil(amount / (AuraChunk.DEFAULT_AURA * 2F) * 15F), 0, 15);
|
||||
if (this.redstonePower != power) {
|
||||
this.redstonePower = power;
|
||||
this.world.updateComparatorOutputLevel(this.pos, this.getBlockType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ public final class ModItems {
|
|||
public static final Item INFUSED_IRON = new ItemImpl("infused_iron");
|
||||
public static final Item ANCIENT_STICK = new ItemImpl("ancient_stick");
|
||||
public static final Item COLOR_CHANGER = new ItemColorChanger();
|
||||
public static final Item AURA_CACHE = new ItemAuraCache();
|
||||
|
||||
public static final Item.ToolMaterial TOOL_MATERIAL_INFUSED_IRON =
|
||||
EnumHelper.addToolMaterial(NaturesAura.MOD_ID.toUpperCase(Locale.ROOT) + "_INFUSED_IRON", 3, 300, 6.25F, 2.25F, 16);
|
||||
|
@ -23,5 +24,4 @@ public final class ModItems {
|
|||
public static final Item INFUSED_SHOVEL = new ItemShovelNA("infused_iron_shovel", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item INFUSED_HOE = new ItemHoeNA("infused_iron_hoe", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item INFUSED_SWORD = new ItemSwordNA("infused_iron_sword", TOOL_MATERIAL_INFUSED_IRON);
|
||||
public static final Item AURA_CACHE = new ItemAuraCache();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"model": "minecraft:cube_all",
|
||||
"textures": {
|
||||
"all": "naturesaura:blocks/aura_detector"
|
||||
},
|
||||
"transform": "forge:default-block"
|
||||
},
|
||||
"variants": {
|
||||
"normal": [{}],
|
||||
"inventory": [{}]
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ tile.naturesaura.ancient_planks.name=Ancient Planks
|
|||
tile.naturesaura.infused_stone.name=Infused Rock
|
||||
tile.naturesaura.furnace_heater.name=Extraneous Firestarter
|
||||
tile.naturesaura.potion_generator.name=Absorber of Lingering
|
||||
tile.naturesaura.aura_detector.name=Aura Detector
|
||||
|
||||
item.naturesaura.eye.name=Environmental Eye
|
||||
item.naturesaura.gold_fiber.name=Brilliant Fiber
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "Aura Detector",
|
||||
"icon": "naturesaura:aura_detector",
|
||||
"category": "using",
|
||||
"advancement": "naturesaura:infused_materials",
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "When working with $(aura), sometimes it can be beneficial to know about its levels in an area without having to be there to check in person. The $(item)Aura Detector$() gives out a $(thing)redstone$() signal based on the amount of $(aura) in the close vicinity around it, so long as you attach a $(item)Comparator$() to it. For that, its range of display is similar to that of the $(l:items/eye)Environmental Eye$()."
|
||||
},
|
||||
{
|
||||
"type": "crafting",
|
||||
"text": "Creating the $(item)Aura Detector$()",
|
||||
"recipe": "naturesaura:aura_detector"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"type": "forge:ore_shaped",
|
||||
"pattern": [
|
||||
"RSR",
|
||||
"SIS",
|
||||
"RSR"
|
||||
],
|
||||
"key": {
|
||||
"S": {
|
||||
"item": "naturesaura:infused_stone"
|
||||
},
|
||||
"R": {
|
||||
"item": "minecraft:redstone"
|
||||
},
|
||||
"I": {
|
||||
"item": "naturesaura:eye"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "naturesaura:aura_detector"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 418 B |
Loading…
Reference in a new issue