mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
added the item grounder and reorganized the book a bit
This commit is contained in:
parent
dd6006f5f9
commit
628f67eb36
22 changed files with 162 additions and 42 deletions
|
@ -134,7 +134,7 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, IMod
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityImpl) {
|
if (tile instanceof TileEntityImpl) {
|
||||||
TileEntityImpl impl = (TileEntityImpl) tile;
|
TileEntityImpl impl = (TileEntityImpl) tile;
|
||||||
impl.isRedstonePowered = world.getRedstonePowerFromNeighbors(pos) > 0;
|
impl.redstonePower = world.getRedstonePowerFromNeighbors(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.Helper;
|
||||||
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPickupStopper;
|
||||||
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
public class BlockPickupStopper extends BlockContainerImpl {
|
||||||
|
public BlockPickupStopper() {
|
||||||
|
super(Material.ROCK, "pickup_stopper", TileEntityPickupStopper.class, "pickup_stopper");
|
||||||
|
this.setSoundType(SoundType.STONE);
|
||||||
|
this.setHardness(2F);
|
||||||
|
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onPickup(EntityItemPickupEvent event) {
|
||||||
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
if (player != null && !player.isSneaking()) {
|
||||||
|
EntityItem item = event.getItem();
|
||||||
|
BlockPos pos = item.getPosition();
|
||||||
|
Helper.getTileEntitiesInArea(item.world, pos, 8, tile -> {
|
||||||
|
if (!(tile instanceof TileEntityPickupStopper))
|
||||||
|
return false;
|
||||||
|
TileEntityPickupStopper stopper = (TileEntityPickupStopper) tile;
|
||||||
|
float radius = stopper.getRadius();
|
||||||
|
if (radius <= 0F)
|
||||||
|
return false;
|
||||||
|
BlockPos stopperPos = stopper.getPos();
|
||||||
|
if (item.getDistanceSq(stopperPos.getX() + 0.5F, stopperPos.getY() + 0.5F, stopperPos.getZ() + 0.5F) > radius * radius)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
event.setCanceled(true);
|
||||||
|
|
||||||
|
if (item.world.getTotalWorldTime() % 3 == 0)
|
||||||
|
PacketHandler.sendToAllAround(item.world, pos, 32,
|
||||||
|
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 14));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,4 +35,5 @@ public final class ModBlocks {
|
||||||
public static final Block OAK_GENERATOR = new BlockOakGenerator();
|
public static final Block OAK_GENERATOR = new BlockOakGenerator();
|
||||||
public static final Block INFUSED_IRON = new BlockImpl("infused_iron_block", Material.IRON).setSoundType(SoundType.METAL).setHardness(3F);
|
public static final Block INFUSED_IRON = new BlockImpl("infused_iron_block", Material.IRON).setSoundType(SoundType.METAL).setHardness(3F);
|
||||||
public static final Block OFFERING_TABLE = new BlockOfferingTable();
|
public static final Block OFFERING_TABLE = new BlockOfferingTable();
|
||||||
|
public static final Block PICKUP_STOPPER = new BlockPickupStopper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntityFieldCreator creator = (TileEntityFieldCreator) other;
|
TileEntityFieldCreator creator = (TileEntityFieldCreator) other;
|
||||||
if (!this.isRedstonePowered && !creator.isRedstonePowered) {
|
if (this.redstonePower <= 0 && creator.redstonePower <= 0) {
|
||||||
this.chargeTimer = 0;
|
this.chargeTimer = 0;
|
||||||
if (this.isCharged) {
|
if (this.isCharged) {
|
||||||
this.isCharged = false;
|
this.isCharged = false;
|
||||||
|
|
|
@ -24,7 +24,7 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class TileEntityImpl extends TileEntity {
|
public class TileEntityImpl extends TileEntity {
|
||||||
|
|
||||||
public boolean isRedstonePowered;
|
public int redstonePower;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
|
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
|
||||||
|
@ -45,14 +45,14 @@ public class TileEntityImpl extends TileEntity {
|
||||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||||
if (type != SaveType.BLOCK) {
|
if (type != SaveType.BLOCK) {
|
||||||
super.writeToNBT(compound);
|
super.writeToNBT(compound);
|
||||||
compound.setBoolean("redstone", this.isRedstonePowered);
|
compound.setInteger("redstone", this.redstonePower);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||||
if (type != SaveType.BLOCK) {
|
if (type != SaveType.BLOCK) {
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
this.isRedstonePowered = compound.getBoolean("redstone");
|
this.redstonePower = compound.getInteger("redstone");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package de.ellpeck.naturesaura.blocks.tiles;
|
||||||
|
|
||||||
|
public class TileEntityPickupStopper extends TileEntityImpl {
|
||||||
|
|
||||||
|
public float getRadius() {
|
||||||
|
return this.redstonePower / 2F;
|
||||||
|
}
|
||||||
|
}
|
|
@ -254,6 +254,14 @@ public class PacketParticles implements IMessage {
|
||||||
world.rand.nextGaussian() * 0.01F,
|
world.rand.nextGaussian() * 0.01F,
|
||||||
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
||||||
break;
|
break;
|
||||||
|
case 14: // Pickup stopper
|
||||||
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
|
message.posX, message.posY + 0.4F, message.posZ,
|
||||||
|
world.rand.nextGaussian() * 0.005F,
|
||||||
|
world.rand.nextFloat() * 0.005F,
|
||||||
|
world.rand.nextGaussian() * 0.005F,
|
||||||
|
0xcc3116, 1.5F, 40, 0F, false, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,8 +41,10 @@ public final class ModRegistry {
|
||||||
block.setRegistryName(NaturesAura.MOD_ID, name);
|
block.setRegistryName(NaturesAura.MOD_ID, name);
|
||||||
ForgeRegistries.BLOCKS.register(block);
|
ForgeRegistries.BLOCKS.register(block);
|
||||||
|
|
||||||
item.setRegistryName(block.getRegistryName());
|
if (item != null) {
|
||||||
ForgeRegistries.ITEMS.register(item);
|
item.setRegistryName(block.getRegistryName());
|
||||||
|
ForgeRegistries.ITEMS.register(item);
|
||||||
|
}
|
||||||
|
|
||||||
if (addCreative)
|
if (addCreative)
|
||||||
block.setCreativeTab(NaturesAura.CREATIVE_TAB);
|
block.setCreativeTab(NaturesAura.CREATIVE_TAB);
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube",
|
||||||
|
"textures": {
|
||||||
|
"particle": "naturesaura:blocks/pickup_stopper",
|
||||||
|
"up": "naturesaura:blocks/pickup_stopper_top",
|
||||||
|
"down": "naturesaura:blocks/pickup_stopper_top",
|
||||||
|
"north": "#particle",
|
||||||
|
"east": "#particle",
|
||||||
|
"south": "#particle",
|
||||||
|
"west": "#particle"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [{}],
|
||||||
|
"inventory": [{}]
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,6 +32,7 @@ tile.naturesaura.field_creator.name=Aura Field Creator
|
||||||
tile.naturesaura.oak_generator.name=Canopy Diminisher
|
tile.naturesaura.oak_generator.name=Canopy Diminisher
|
||||||
tile.naturesaura.infused_iron_block.name=Infused Iron Block
|
tile.naturesaura.infused_iron_block.name=Infused Iron Block
|
||||||
tile.naturesaura.offering_table.name=Offering Table
|
tile.naturesaura.offering_table.name=Offering Table
|
||||||
|
tile.naturesaura.pickup_stopper.name=Item Grounder
|
||||||
|
|
||||||
item.naturesaura.eye.name=Environmental Eye
|
item.naturesaura.eye.name=Environmental Eye
|
||||||
item.naturesaura.gold_fiber.name=Brilliant Fiber
|
item.naturesaura.gold_fiber.name=Brilliant Fiber
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Collecting Aura",
|
|
||||||
"description": "To be able to make use of the $(aura) in the world, one must first find a way to handle it reasonably. Converting it into a storable form $(italics)(no, not liquids)$() might prove somewhat difficult, but this category will provide guidance.",
|
|
||||||
"icon": "naturesaura:textures/gui/patchouli/categories/collecting.png",
|
|
||||||
"sortnum": 10
|
|
||||||
}
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "Mechanical Devices",
|
||||||
|
"description": "Some machines do not directly harness the power of $(aura), but rather, they make use of the items created using it to achieve functionalities that other devices can not. This section houses such devices and instruments.",
|
||||||
|
"icon": "naturesaura:textures/gui/patchouli/categories/devices.png",
|
||||||
|
"sortnum": 30
|
||||||
|
}
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
"name": "The Natural Altar",
|
|
||||||
"icon": "naturesaura:nature_altar",
|
|
||||||
"category": "collecting",
|
|
||||||
"advancement": "naturesaura:aura_bottle_overworld",
|
|
||||||
"priority": true,
|
|
||||||
"pages": [
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"text": "A rudimentary, yet effective way of collecting $(aura) early on is the $(item)Natural Altar$(). After creating the setup shown on the following page, the altar will start slowly draining $(aura) in the vicinity. However, it is not strong enough to cause major damage, making it only drain until there is none left in the area.$(br)The collected $(aura) can then be used in several ways, $(l:using/altar)infusing items$() for instance."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "multiblock",
|
|
||||||
"multiblock_id": "naturesaura:altar",
|
|
||||||
"text": "How to assemble the $(item)Natural Altar$()"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "naturesaura:tree_ritual",
|
|
||||||
"text": "Creating the $(item)Natural Altar$() using the $(l:practices/tree_ritual)Ritual of the Forest$()",
|
|
||||||
"recipe": "naturesaura:nature_altar"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "Aura Detector",
|
"name": "Aura Detector",
|
||||||
"icon": "naturesaura:aura_detector",
|
"icon": "naturesaura:aura_detector",
|
||||||
"category": "using",
|
"category": "devices",
|
||||||
"advancement": "naturesaura:infused_materials",
|
"advancement": "naturesaura:infused_materials",
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "Item Grounder",
|
||||||
|
"icon": "naturesaura:pickup_stopper",
|
||||||
|
"category": "devices",
|
||||||
|
"advancement": "naturesaura:infused_materials",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "A lot of mechanisms require the use of dropped $(thing)items$() in the world, which can easily be picked up by people inspecting the mechanism on accident.$(br)The $(item)Item Grounder$() causes items in the area to only be picked up by anyone if they're sneaking. Its area of effect ranges from 0 to 8 blocks around it and is determined, relatively, by the strength of the $(thing)redstone signal$() applied."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"text": "Creating the $(item)Item Grounder$()",
|
||||||
|
"recipe": "naturesaura:pickup_stopper"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,9 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "Aura Bottling",
|
"name": "Aura Bottling",
|
||||||
"icon": "naturesaura:aura_bottle{stored_type:'naturesaura:overworld'}",
|
"icon": "naturesaura:aura_bottle{stored_type:'naturesaura:overworld'}",
|
||||||
"category": "collecting",
|
"category": "practices",
|
||||||
"advancement": "naturesaura:wood_stand",
|
"advancement": "naturesaura:wood_stand",
|
||||||
"priority": true,
|
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
|
@ -1,13 +1,27 @@
|
||||||
{
|
{
|
||||||
"name": "Natural Altar Infusion",
|
"name": "The Natural Altar",
|
||||||
"icon": "naturesaura:nature_altar",
|
"icon": "naturesaura:nature_altar",
|
||||||
"category": "using",
|
"category": "using",
|
||||||
"advancement": "naturesaura:altar",
|
"advancement": "naturesaura:aura_bottle_overworld",
|
||||||
"priority": true,
|
"priority": true,
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"text": "When the $(l:collecting/altar)Natural Altar$() has collected a sufficient amount of $(aura), it will be able to infuse items of certain materials, converting them into different, more powerful materials. To do this, simply place any material onto the altar and wait for the infusion to be completed.$(br2)The following pages list some useful materials that a botanist might frequently need."
|
"text": "A rudimentary, yet effective way of collecting $(aura) early on is the $(item)Natural Altar$(). After creating the setup shown on the following page, the altar will start slowly draining $(aura) in the vicinity. However, it is not strong enough to cause major damage, making it only drain until there is none left in the area.$(br)The collected $(aura) can then be used as shown on the following pages."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "multiblock",
|
||||||
|
"multiblock_id": "naturesaura:altar",
|
||||||
|
"text": "How to assemble the $(item)Natural Altar$()"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "naturesaura:tree_ritual",
|
||||||
|
"text": "Creating the $(item)Natural Altar$() using the $(l:practices/tree_ritual)Ritual of the Forest$()",
|
||||||
|
"recipe": "naturesaura:nature_altar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "When the $(item)Natural Altar$() has collected a sufficient amount of $(aura), it will be able to infuse items of certain materials, converting them into different, more powerful materials. To do this, simply place any material onto the altar and wait for the infusion to be completed.$(br2)The following pages list some useful materials that a botanist might frequently need."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "naturesaura:altar",
|
"type": "naturesaura:altar",
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"type": "forge:ore_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"CIC",
|
||||||
|
"CDC",
|
||||||
|
"CIC"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"D": {
|
||||||
|
"item": "minecraft:slime_ball"
|
||||||
|
},
|
||||||
|
"I": {
|
||||||
|
"item": "naturesaura:infused_iron"
|
||||||
|
},
|
||||||
|
"C":{
|
||||||
|
"item":"minecraft:cobblestone"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "naturesaura:pickup_stopper"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 526 B |
Binary file not shown.
After Width: | Height: | Size: 625 B |
Binary file not shown.
Before Width: | Height: | Size: 606 B |
Binary file not shown.
After Width: | Height: | Size: 549 B |
Loading…
Reference in a new issue