I understand that I have posted this suggestion before, but I wanted to make sure it was not forgotten. A very convenient addition to the ship controller's API would be a method that took a set of world coordinates and attempted to jump as far towards those coordinates as possible. This could be accomplished relatively easily, and would make navigation much easier.
Are there any plans to add a function to the warp controller that will either take in a direction Vector or coordinates, and warp the ship in that direction?
I need this TileEntity to update the blocks above it, if they are the right kind of block. When I use the code below in the TileEntity's UpdateEntity method, the blocks above do not appear to have updated. However, when i rejoin, the block's Metadata appears to have been changed, but when i update the main block they all are reset back to their original state. I can verify that the SetTubeState() method is being called correctly.
I am using the Industrialcraft 2 API.
TileEntityMatterInjectorBase:
package com.Spector19.Tardismod.tileentity;
import com.Spector19.Tardismod.blocks.ModBlocks;
import ic2.api.energy.prefab.BasicSink;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileEntityMatterInjectorBase extends TileEntity {
private BasicSink ic2EnergySink = new BasicSink(this, 100000, 3);
private Boolean Active = true;
public TileEntityMatterInjectorBase(){}
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
ic2EnergySink.readFromNBT(tag);
NBTTagCompound Data = tag.getCompoundTag("MITEntity");
this.Active = Data.getBoolean("active");
}
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
ic2EnergySink.writeToNBT(tag);
NBTTagCompound Data = new NBTTagCompound();
Data.setBoolean("active", this.Active);
tag.setTag("MITEntity", Data);
}
@Override
public void updateEntity() {
ic2EnergySink.updateEntity();
if (this.Active){
if (ic2EnergySink.useEnergy(32)) {
SetTubeState(true);
} else {
SetTubeState(false);
}
}
}
@Override
public void invalidate() {
ic2EnergySink.invalidate();
super.invalidate();
}
public void onChunkUnload() {
ic2EnergySink.onChunkUnload();
}
public void SetTubeState(Boolean tbo) {
for(int y=1; y<6; y++){
Block GottenBlock = this.worldObj.getBlock(this.xCoord, this.yCoord+y, this.zCoord);
if (GottenBlock == ModBlocks.MatterInjectorTubeBlock){
if (tbo) {
if (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord+y, this.zCoord) != 1){
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord+y, this.zCoord, 1, 3);
}
} else {
if (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord+y, this.zCoord) != 0){
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord+y, this.zCoord, 0, 3);
}
}
} else {
break;
}
}
}
}
but it does not seem to be consistent. The reason i am not using the conventional way of animating textures is because i need to have it preform the animation, then execute some code after it is finished.
How would I cause code running inside a TileEntity to wait? Thread.Sleep() just pauses the entire game (I assume this is because the game is run on a single thread).
Thank you for your reply, but I figured out what i did wrong. I was not getting the dimension names correctly (the method i was using always returns the SERVER name, not the dimension name), and when i attempted to get the ID back from that it just returned the nether's dimension ID.
From what i have seen of mods like RFTools and Mystcraft, dimension IDs can change when a world is reloaded. Correct me if am wrong, but i believe that dimension names do NOT change when worlds are reloaded (the names of the dimension folders remain constant). Is there any way to get a dimension's name from its ID? I know that you can get the ID from the dimension name (code below), but how do you get the ID back from that string?
public World GetWorldFromName(String s){
WorldServer[] Worlds = DimensionManager.getWorlds();
for (WorldServer world : Worlds) {
if (world.getWorldInfo().getWorldName() == s){
return world;
}
}
return null;
}
0
Can you please update the Wiki with the API changes to the ship controller?
0
I understand that I have posted this suggestion before, but I wanted to make sure it was not forgotten. A very convenient addition to the ship controller's API would be a method that took a set of world coordinates and attempted to jump as far towards those coordinates as possible. This could be accomplished relatively easily, and would make navigation much easier.
0
Are there any plans to add a function to the warp controller that will either take in a direction Vector or coordinates, and warp the ship in that direction?
0
It may be a good idea to pick apart the existing program, its a great example of how the controller interface works.
0
It seems that sometimes when I use DimensionManager.getWorld(), it returns Null. This only happens after the world has been loaded for a few minutes.
EDIT: It also appears that the data is not saving when Minecraft is reloaded.
Relavent Code:
0
I need this TileEntity to update the blocks above it, if they are the right kind of block. When I use the code below in the TileEntity's UpdateEntity method, the blocks above do not appear to have updated. However, when i rejoin, the block's Metadata appears to have been changed, but when i update the main block they all are reset back to their original state. I can verify that the SetTubeState() method is being called correctly.
I am using the Industrialcraft 2 API.
TileEntityMatterInjectorBase:
BlockMatterInjectorTube:
0
Thank you, I now have it working perfectly.
0
I have tried this:
@Override
public void updateEntity() {
if (this.CurrentState > 0){
if (this.CurrentState == 9) {
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 9, 3);
this.CurrentState = 1;
} else {
this.CurrentState++;
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, this.CurrentState, 3);
}
}
}
but it does not seem to be consistent. The reason i am not using the conventional way of animating textures is because i need to have it preform the animation, then execute some code after it is finished.
0
How would I cause code running inside a TileEntity to wait? Thread.Sleep() just pauses the entire game (I assume this is because the game is run on a single thread).
0
Thank you. None of the tutorials stated that the TileEntity's constructor needed to have a set number of arguments.
0
Thank you for your reply, but I figured out what i did wrong. I was not getting the dimension names correctly (the method i was using always returns the SERVER name, not the dimension name), and when i attempted to get the ID back from that it just returned the nether's dimension ID.
0
My Tile entity is throwing an error when the game loads. The Entity is being registered, so i don't understand what the issue is.
Error:
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.InstantiationException: com.Spector19.Tardismod.tileentity.tileentityExteriorTeleporter
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.Class.newInstance(Unknown Source)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.tileentity.TileEntity.createAndLoadEntity(TileEntity.java:123)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:525)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:144)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:305)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: Caused by: java.lang.NoSuchMethodException: com.Spector19.Tardismod.tileentity.tileentityExteriorTeleporter.<init>()
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.Class.getConstructor0(Unknown Source)
[07:22:14] [Server thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: ... 15 more
[07:22:14] [Server thread/WARN]: Skipping BlockEntity with id TCapsule_ExteriorTeleporter
0
Im pretty sure that if you use GetBlock() anywhere in a dimension it will load it for a short time.
0
From what i have seen of mods like RFTools and Mystcraft, dimension IDs can change when a world is reloaded. Correct me if am wrong, but i believe that dimension names do NOT change when worlds are reloaded (the names of the dimension folders remain constant). Is there any way to get a dimension's name from its ID? I know that you can get the ID from the dimension name (code below), but how do you get the ID back from that string?
0
Any help?