Added recipe, effects and localization for ender rail.

This commit is contained in:
CrazyPants committed 2014-10-26 00:27:51 +08:00
1 parent 25a05dc1a8
commit 02eccba10a
8 files changed
+136 -33

No files matched your search

+6
View File
@@ -263,6 +263,12 @@ tile.blockTransceiver.tooltip.detailed.line1=Transports items, fluids and power
tile.blockTransceiver.tooltip.detailed.line2=wirelessly across any distance and
tile.blockTransceiver.tooltip.detailed.line3=between dimensions
tile.blockEnderRail.name=Ender Rail
tile.blockEnderRail.tooltip.detailed.line1=Teleports minecarts when placed
tile.blockEnderRail.tooltip.detailed.line2=on a Dimensional Transceiver
tile.blockEnderRail.tooltip.detailed.line3=Set destinations using the
tile.blockEnderRail.tooltip.detailed.line4=Transceiver's rail tab
enderio.trans.showChannels=<Shift to show channels>
enderio.trans.power=Power
@@ -303,6 +303,8 @@ public final class Config {
public static int soulBinderEnderCystalLevels = 10;
public static int soulBinderAttractorCystalRF = 100000;
public static int soulBinderAttractorCystalLevels = 10;
public static int soulBinderEnderRailRF = 100000;
public static int soulBinderEnderRailLevels = 10;
public static boolean powerConduitCanDifferentTiersConnect = false;
@@ -881,6 +883,8 @@ public final class Config {
"The number of RF required to create an ender crystal.").getInt(soulBinderEnderCystalRF);
soulBinderAttractorCystalRF = config.get(sectionSoulBinder.name, "soulBinderAttractorCystalRF", soulBinderAttractorCystalRF,
"The number of RF required to create an attractor crystal.").getInt(soulBinderAttractorCystalRF);
soulBinderEnderRailRF = config.get(sectionSoulBinder.name, "soulBinderEnderRailRF", soulBinderEnderRailRF,
"The number of RF required to create an ender rail.").getInt(soulBinderEnderRailRF);
soulBinderAttractorCystalLevels = config.get(sectionSoulBinder.name, "soulBinderAttractorCystalLevels", soulBinderAttractorCystalLevels,
"The number of levels required to create an attractor crystal.").getInt(soulBinderAttractorCystalLevels);
@@ -890,6 +894,9 @@ public final class Config {
"The number of levels required to re-animate a mob head.").getInt(soulBinderReanimationLevels);
soulBinderBrokenSpawnerLevels = config.get(sectionSoulBinder.name, "soulBinderBrokenSpawnerLevels", soulBinderBrokenSpawnerLevels,
"The number of levels required to change the type of a broken spawner.").getInt(soulBinderBrokenSpawnerLevels);
soulBinderEnderRailLevels = config.get(sectionSoulBinder.name, "soulBinderEnderRailLevels", soulBinderEnderRailLevels,
"The number of levels required to create an ender rail.").getInt(soulBinderEnderRailLevels);
sliceAndSpliceLevelOnePowerPerTickRF = config.get(sectionPower.name, "sliceAndSpliceLevelOnePowerPerTickRF", sliceAndSpliceLevelOnePowerPerTickRF,
"The number of RF/t consumed by an unupgraded Slice'N'Splice").getInt(sliceAndSpliceLevelOnePowerPerTickRF);
@@ -235,11 +235,7 @@ public class MachineRecipes {
ClearConfigRecipe inst = new ClearConfigRecipe();
MinecraftForge.EVENT_BUS.register(inst);
GameRegistry.addRecipe(inst);
//Ender Rail
if(Config.enderRailEnabled) {
}
}
public static void addOreDictionaryRecipes() {
@@ -13,7 +13,7 @@ public class SoulBinderEnderCystalRecipe extends AbstractSoulBinderRecipe {
public static SoulBinderEnderCystalRecipe instance = new SoulBinderEnderCystalRecipe();
private SoulBinderEnderCystalRecipe() {
super(Config.soulBinderEnderCystalRF,Config.soulBinderEnderCystalLevels, "SoulBinderEnderCystalRecipe", "Enderman", "SpecialMobs.SpecialEnderman");
super(Config.soulBinderEnderCystalRF,Config.soulBinderEnderCystalLevels, "SoulBinderEnderCystalRecipe", "SpecialMobs.SpecialEnderman", "Enderman");
}
@Override
@@ -5,8 +5,10 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import crazypants.enderio.EnderIO;
import crazypants.enderio.Log;
import crazypants.enderio.ModObject;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.MachineRecipeRegistry;
public class SoulBinderRecipeManager {
@@ -14,7 +16,7 @@ public class SoulBinderRecipeManager {
private static final SoulBinderRecipeManager instance = new SoulBinderRecipeManager();
public static final String IMC_KEY = "recipe:soulbinder";
public static final String KEY_RECIPE_UID = "recipeUID";
public static final String KEY_INPUT_STACK = "inputStack";
public static final String KEY_OUTPUT_STACK = "outputStack";
@@ -31,27 +33,34 @@ public class SoulBinderRecipeManager {
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockSoulBinder.unlocalisedName, SoulBinderReanimationRecipe.instance);
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockSoulBinder.unlocalisedName, SoulBinderEnderCystalRecipe.instance);
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockSoulBinder.unlocalisedName, SoulBinderAttractorCystalRecipe.instance);
//Ender Rail
if(Config.enderRailEnabled) {
BasicSoulBinderRecipe err = new BasicSoulBinderRecipe(new ItemStack(Blocks.detector_rail), new ItemStack(EnderIO.blockEnderRail),
Config.soulBinderEnderRailRF, Config.soulBinderEnderRailLevels, "SpecialMobs.SpecialEnderman", "Enderman");
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockSoulBinder.unlocalisedName, err);
}
}
// Example of how to add a recipe:
//
// NBTTagCompound root = new NBTTagCompound();
// root.setString(SoulBinderRecipeManager.KEY_RECIPE_UID, "diamondToWood");
// root.setInteger(SoulBinderRecipeManager.KEY_REQUIRED_ENERGY, 50000);
// root.setInteger(SoulBinderRecipeManager.KEY_REQUIRED_XP, 7);
// root.setString(SoulBinderRecipeManager.KEY_SOUL_TYPES, "Zombie|SpecialMobs.SpecialZombie|Villager");
// ItemStack is = new ItemStack(Items.diamond);
// NBTTagCompound stackRoot = new NBTTagCompound();
// is.writeToNBT(stackRoot);
// root.setTag(SoulBinderRecipeManager.KEY_INPUT_STACK, stackRoot);
// is = new ItemStack(Blocks.planks);
// stackRoot = new NBTTagCompound();
// is.writeToNBT(stackRoot);
// root.setTag(SoulBinderRecipeManager.KEY_OUTPUT_STACK, stackRoot);
//
// SoulBinderRecipeManager.getInstance().addRecipeFromNBT(root);
// FMLInterModComms.sendMessage("EnderIO", "recipe:soulbinder", root);
// Example of how to add a recipe:
//
// NBTTagCompound root = new NBTTagCompound();
// root.setString(SoulBinderRecipeManager.KEY_RECIPE_UID, "diamondToWood");
// root.setInteger(SoulBinderRecipeManager.KEY_REQUIRED_ENERGY, 50000);
// root.setInteger(SoulBinderRecipeManager.KEY_REQUIRED_XP, 7);
// root.setString(SoulBinderRecipeManager.KEY_SOUL_TYPES, "Zombie|SpecialMobs.SpecialZombie|Villager");
// ItemStack is = new ItemStack(Items.diamond);
// NBTTagCompound stackRoot = new NBTTagCompound();
// is.writeToNBT(stackRoot);
// root.setTag(SoulBinderRecipeManager.KEY_INPUT_STACK, stackRoot);
// is = new ItemStack(Blocks.planks);
// stackRoot = new NBTTagCompound();
// is.writeToNBT(stackRoot);
// root.setTag(SoulBinderRecipeManager.KEY_OUTPUT_STACK, stackRoot);
//
// SoulBinderRecipeManager.getInstance().addRecipeFromNBT(root);
// FMLInterModComms.sendMessage("EnderIO", "recipe:soulbinder", root);
public boolean addRecipeFromNBT(NBTTagCompound root) {
try {
String recipeUid = root.getString(KEY_RECIPE_UID);
@@ -34,15 +34,18 @@ import crazypants.enderio.Log;
import crazypants.enderio.ModObject;
import crazypants.enderio.conduit.ConduitUtil;
import crazypants.enderio.config.Config;
import crazypants.enderio.gui.IResourceTooltipProvider;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.enderio.machine.transceiver.Channel;
import crazypants.enderio.machine.transceiver.ChannelType;
import crazypants.enderio.machine.transceiver.ServerChannelRegister;
import crazypants.enderio.machine.transceiver.TileTransceiver;
import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.teleport.packet.PacketConfigSync;
import crazypants.util.MetadataUtil;
import crazypants.util.RoundRobinIterator;
public class BlockEnderRail extends BlockRail {
public class BlockEnderRail extends BlockRail implements IResourceTooltipProvider {
public static boolean isReverse(int meta) {
return MetadataUtil.isBitSet(3, meta);
@@ -66,6 +69,7 @@ public class BlockEnderRail extends BlockRail {
}
public static BlockEnderRail create() {
PacketHandler.INSTANCE.registerMessage(PacketTeleportEffects.class, PacketTeleportEffects.class, PacketHandler.nextID(), Side.CLIENT);
BlockEnderRail res = new BlockEnderRail();
res.init();
return res;
@@ -88,7 +92,7 @@ public class BlockEnderRail extends BlockRail {
private void init() {
GameRegistry.registerBlock(this, ModObject.blockEnderRail.unlocalisedName);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
@@ -121,14 +125,14 @@ public class BlockEnderRail extends BlockRail {
// }
return false;
}
@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
if(!world.isRemote) {
if(!world.isRemote) {
TileEntity te = world.getTileEntity(x, y - 1, z);
System.out.println("BlockEnderRail.removedByPlayer: " + te);
if(te instanceof TileTransceiver) {
((TileTransceiver)te).getRailController().dropNonSpawnedCarts();
((TileTransceiver) te).getRailController().dropNonSpawnedCarts();
}
}
return super.removedByPlayer(world, player, x, y, z, willHarvest);
@@ -230,7 +234,7 @@ public class BlockEnderRail extends BlockRail {
Block blk = reciever.getWorldObj().getBlock(reciever.xCoord, reciever.yCoord + 1, reciever.zCoord);
if(blk != EnderIO.blockEnderRail) {
return false;
}
}
return reciever.getRailController().isClear();
}
@@ -244,7 +248,7 @@ public class BlockEnderRail extends BlockRail {
int powerRequired = 0;
if(sender.getWorldObj().provider.dimensionId != reciever.getWorldObj().provider.dimensionId) {
powerRequired = Config.enderRailPowerRequireCrossDimensions;
} else {
} else {
powerRequired += sender.getLocation().distance(reciever.getLocation()) * Config.enderRailPowerRequiredPerBlock;
if(Config.enderRailCapSameDimensionPowerAtCrossDimensionCost) {
powerRequired = Math.min(powerRequired, Config.enderRailPowerRequireCrossDimensions);
@@ -273,6 +277,7 @@ public class BlockEnderRail extends BlockRail {
}
for (EntityMinecart despawnCart : toDespawn) {
TeleportUtil.spawnTeleportEffects(world, despawnCart);
TeleportUtil.despawn(sender.getWorldObj(), despawnCart);
}
@@ -285,4 +290,9 @@ public class BlockEnderRail extends BlockRail {
return false;
}
@Override
public String getUnlocalizedNameForTooltip(ItemStack itemStack) {
return getUnlocalizedName();
}
}
@@ -0,0 +1,62 @@
package crazypants.enderio.rail;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.EnderIO;
import crazypants.enderio.teleport.packet.PacketDrainStaff;
import crazypants.util.BlockCoord;
import crazypants.util.ClientUtil;
public class PacketTeleportEffects implements IMessage, IMessageHandler<PacketTeleportEffects, IMessage> {
double x;
double y;
double z;
public PacketTeleportEffects() {
}
public PacketTeleportEffects(Entity ent) {
x = ent.posX;
y = ent.posY;
z = ent.posZ;
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeDouble(x);
buf.writeDouble(y);
buf.writeDouble(z);
}
@Override
public void fromBytes(ByteBuf buf) {
x = buf.readDouble();
y = buf.readDouble();
z = buf.readDouble();
}
@Override
public IMessage onMessage(PacketTeleportEffects message, MessageContext ctx) {
EntityPlayer player = EnderIO.proxy.getClientPlayer();
World world = player.worldObj;
Random rand = world.rand;
for (int i = 0; i < 15; i++) {
double xOff = (rand.nextDouble() - 0.5) * 1.1;
double yOff = (rand.nextDouble() - 0.5) * 0.2;
double zOff = (rand.nextDouble() - 0.5) * 1.1;
Minecraft.getMinecraft().theWorld.spawnParticle("portal", message.x + xOff, message.y + yOff, message.z + zOff, (rand.nextDouble() - 0.5) * 1.5, -rand.nextDouble(),
(rand.nextDouble() - 0.5) * 1.5);
}
return null;
}
}
@@ -4,8 +4,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import mods.railcraft.api.carts.CartTools;
import mods.railcraft.api.carts.ILinkageManager;
import net.minecraft.entity.Entity;
@@ -19,7 +22,10 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import crazypants.enderio.EnderIO;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.transceiver.TileTransceiver;
import crazypants.enderio.network.PacketHandler;
import crazypants.vecmath.Vector3d;
public class TeleportUtil {
@@ -89,6 +95,13 @@ public class TeleportUtil {
worldserver.spawnEntityInWorld(entity);
}
}
public static void spawnTeleportEffects(World world, Entity entity) {
PacketHandler.INSTANCE.sendToAllAround(new PacketTeleportEffects(entity),new TargetPoint(world.provider.dimensionId, entity.posX, entity.posY, entity.posZ, 64));
if(Config.machineSoundsEnabled) {
world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 0.5F, 0.25F);
}
}
//------------ Link Utils