finished the rails

This commit is contained in:
Ellpeck 2019-03-31 14:17:29 +02:00
parent 5ed6598b4d
commit d21ca60c2d
7 changed files with 149 additions and 4 deletions

View file

@ -82,13 +82,12 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
@Override
public void spawnParticleStream(float startX, float startY, float startZ, float endX, float endY, float endZ, float speed, int color, float scale) {
Vector3f dir = new Vector3f(endX - startX, endY - startY, endZ - startZ);
if (dir.length() > 0) {
int maxAge = (int) (dir.length() / speed);
float length = dir.length();
if (length > 0) {
dir.normalise();
this.spawnMagicParticle(startX, startY, startZ,
dir.x * speed, dir.y * speed, dir.z * speed,
color, scale, maxAge, 0F, false, false);
color, scale, (int) (length / speed), 0F, false, false);
}
}

View file

@ -4,6 +4,7 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.packet.PacketClient;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICreativeItem;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider;
@ -16,10 +17,13 @@ import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.DimensionType;
import net.minecraft.world.IBlockAccess;
@ -78,6 +82,12 @@ public class BlockDimensionRail extends BlockRailBase implements IModItem, ICrea
if (!this.canUseHere(world.provider.getDimensionType()))
return;
AxisAlignedBB box = cart.getEntityBoundingBox();
PacketHandler.sendToAllAround(world, pos, 32,
new PacketParticles((float) box.minX, (float) box.minY, (float) box.minZ, 25,
(int) ((box.maxX - box.minX) * 100F), (int) ((box.maxY - box.minY) * 100F), (int) ((box.maxZ - box.minZ) * 100F)));
world.playSound(null, pos, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.BLOCKS, 1F, 1F);
BlockPos goalCoords = this.getGoalCoords(world, pos);
cart.changeDimension(this.goalDim, (newWorld, entity, yaw) ->
entity.moveToBlockPosAndAngles(goalCoords, yaw, entity.rotationPitch));

View file

@ -403,6 +403,17 @@ public class PacketParticles implements IMessage {
0.65F, message.data[3 + world.rand.nextInt(message.data.length - 3)], 1F);
NaturesAuraAPI.instance().setParticleSpawnRange(32);
break;
case 25: // Dimension rail
float width = message.data[0] / 100F;
height = message.data[1] / 100F;
float depth = message.data[2] / 100F;
for (int i = world.rand.nextInt(100) + 50; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat() * width,
message.posY + world.rand.nextFloat() * height,
message.posZ + world.rand.nextFloat() * depth,
0F, 0F, 0F, 0xd60cff, 1F + world.rand.nextFloat(), 60, 0F, false, true);
break;
}
}
});

View file

@ -0,0 +1,35 @@
{
"name": "Rails of the Worlds",
"icon": "naturesaura:dimension_rail_nether",
"category": "using",
"advancement": "naturesaura:sky_ingot",
"pages": [
{
"type": "text",
"text": "While $(item)Minecarts$() have a limited ability to travel through any kind of $(thing)portals$(), it is definitely a complicated setup to create. The $(item)Rails of the Worlds$() solve that problem easily: There are three kinds, one for each of the known dimensions. When a minecart travels over one of them, it is transported to the rail's assigned dimension directly, while using some $(aura) in the process."
},
{
"type": "text",
"text": "The selection of the $(thing)position$() to which the minecarts are sent is based on the dimensions involved in the travel:$(br)Traveling between the overworld and the nether will cause the minecart to be sent to an eighth of its position and back, similary to how normal portals work.$(br)Traveling between the overworld and the end will cause the minecart to be sent to the $(thing)obsidian platform$(), and to the overworld's spawn point when traveling the other way."
},
{
"type": "text",
"text": "Using a $(l:items/range_visualizer)Mystical Magnifier$() on any of the rails will cause the destination position to be highlighted in the destination dimension, with the highlight being visible $(thing)through walls$(), making it easy to find without much hassle.$(p)The only known caveat to these rails is that it seems that they do not have enough power to transport carts containing $(thing)living beings$()."
},
{
"type": "crafting",
"text": "Creating the $(item)Rail of the Overworld$()",
"recipe": "naturesaura:dimension_rail_overworld"
},
{
"type": "crafting",
"text": "Creating the $(item)Rail of the Nether$()",
"recipe": "naturesaura:dimension_rail_nether"
},
{
"type": "crafting",
"text": "Creating the $(item)Rail of the End$()",
"recipe": "naturesaura:dimension_rail_end"
}
]
}

View file

@ -0,0 +1,30 @@
{
"type": "forge:ore_shaped",
"pattern": [
"IEI",
"ISI",
"IOI"
],
"key": {
"E": {
"item": "naturesaura:token_rage"
},
"O": {
"type": "minecraft:item_nbt",
"item": "naturesaura:aura_bottle",
"nbt": {
"stored_type": "naturesaura:end"
}
},
"S": {
"type": "forge:ore_dict",
"ore": "stickWood"
},
"I": {
"item": "naturesaura:sky_ingot"
}
},
"result": {
"item": "naturesaura:dimension_rail_end"
}
}

View file

@ -0,0 +1,30 @@
{
"type": "forge:ore_shaped",
"pattern": [
"IEI",
"ISI",
"IOI"
],
"key": {
"E": {
"item": "naturesaura:token_terror"
},
"O": {
"type": "minecraft:item_nbt",
"item": "naturesaura:aura_bottle",
"nbt": {
"stored_type": "naturesaura:nether"
}
},
"S": {
"type": "forge:ore_dict",
"ore": "stickWood"
},
"I": {
"item": "naturesaura:sky_ingot"
}
},
"result": {
"item": "naturesaura:dimension_rail_nether"
}
}

View file

@ -0,0 +1,30 @@
{
"type": "forge:ore_shaped",
"pattern": [
"IEI",
"ISI",
"IOI"
],
"key": {
"E": {
"item": "naturesaura:token_euphoria"
},
"O": {
"type": "minecraft:item_nbt",
"item": "naturesaura:aura_bottle",
"nbt": {
"stored_type": "naturesaura:overworld"
}
},
"S": {
"type": "forge:ore_dict",
"ore": "stickWood"
},
"I": {
"item": "naturesaura:infused_iron"
}
},
"result": {
"item": "naturesaura:dimension_rail_overworld"
}
}