Jump to content

kauan99

Members
  • Posts

    210
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Personal Text
    I'm not a robot, I'm a real boy!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

kauan99's Achievements

Creeper Killer

Creeper Killer (4/8)

7

Reputation

  1. would be nice to get some real performance going... Is it possible? I mean, it's OpenGL, basically. Hell, why not a DirectX3D? CUDA? nVidia's GTX ti boards are all around us, can't we improve on Notch's work? let's do it!
  2. Guys, I got 2 replies to my question, but none of them answer what I asked. Anyone?
  3. For the moment I can`t upgrade to 1.8 because I develop my mods mostly for personal use either on hamachi servers or cheap paid hosts and 1.8 is kind of heavier (not sure if it`s heavy on the host or on the bandwidth). Just my friends and I use my mods. I kind of use my friends as a beta test group. Once I`m satisfied I plan to release them for the general public.
  4. MCPBot is for 1.8.x only. Just one more question: if i rename the parameters and locals but don't redistribute the modified source is that against Mojang's policy too? And will my mod work on any computer with normal forge installed?
  5. thanks. I didn't know Mojang had a problem with that. I will look this MCPBot up. About 1.8, I have concerns regarding small servers performance. don't seem 1.8 does very well
  6. I imported the whole net namespace into my eclipse workspace. I'm changing the names of parameters and locals, to make the methods clearer on first glance. I'm not going to recompile that namespace (my plan is to remove net from my source code before building) Will my mods still work properly if I do this? Edit: If it works, I plan to follow the naming standard for all the already deobfuscated parameter names, and then share the clearer source code with the community.
  7. I was wondering if I could make my block emit different amounts of light at different moments according to the progress of it's work. Is that possible?
  8. My pipes won't connect to others (they are teleport pipes: 1 extractor paired with 1 inserter). They only change appearance according to their metadata, that is set the moment the pipe is placed, to indicate to which side is the inventory they are connected to. I have a 1x1x1 cube working perfectly for both extractor and inserter, with all faces displaying an arrow relative to the connected inventory (the extractor displays an arrow that points away from the inventory, the inserter an arrow pointing towards the inventory). This proves my metadata logic is correct. I tried to use Block#setBlockBoundsBasedOnState but it turned adjacent sides of neighbor blocks invisible. It kind of worked, if it wasn't for making stuff invisible. Is there something I'm missing?
  9. I understand now. Thanks both of you.
  10. yes. I don't want to make them bigger, but smaller. I want them to have a smaller collision box and to be drawn accordingly. I don't want each of my pipes to be a 1x1x1 cube, you see.
  11. I have the following code (simplified to improve readability): This is my implementation of IMessage. public class ClientToServerMsg implements IMessage { private String key; private int x; private int y; private int z; public ClientToServerMsg() { } public ClientToServerMsg(String key, byte firstIndex, byte lastIndex, int x, int y, int z) { this.key = key; this.x = x; this.y = y; this.z = z; } @Override public void fromBytes(ByteBuf buf) { this.key = ByteBufUtils.readUTF8String(buf); this.x = buf.readInt(); this.y = buf.readInt(); this.z = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, key); buf.writeInt(this.x); buf.writeInt(this.y); buf.writeInt(this.z); } public static class Handler implements IMessageHandler<ClientToServerMsg, ServerResponse> { @Override public ServerResponse onMessage(ClientToServerMsg message, MessageContext ctx) { if(ctx.side == Side.SERVER)//note here that this code only runs if side == SERVER { boolean needsReply = false; EntityPlayerMP player = ctx.getServerHandler().playerEntity; TileEntity te = player.worldObj.getTileEntity(message.x, message.y, message.z); if(te instanceof MyTileEntity) { MyTileEntity myTile = (MyTileEntity)te; if(myTile.setKey(message.key))//this line throws the exception NoSuchMethodError needsReply = true; } if(needsReply) { return new ServerResponse(message.key, message.x, message.y, message.z); } } return null; } } } this is how I register the messages: channel = NetworkRegistry.INSTANCE.newSimpleChannel("mymodchannel"); channel.registerMessage(ClientToServerMsg.Handler.class, ClientToServerMsg.class, 0, Side.SERVER); channel.registerMessage(ServerResponse.Handler.class, ServerResponse.class, 1, Side.CLIENT); and this is the TileEntity: public class MyTileEntity extends TileEntity { @SideOnly(Side.SERVER) public boolean setKey(String key) { //method body } } I annotated MyTileEntity#setKey with @SideOnly(Side.SERVER) because I wanted this exact exception thrown in case I tried to call this method from the client side. Why doesn't it work? If I change setKey to this: public boolean setKey(String key) { if(!this.worldObj.isRemote) { //then inside this method, the moment I try to use a class marked with @SideOnly(Side.SERVER) //I get the error java.lang.NoClassDefFoundError //java.lang.RuntimeException: Attempted to load class MyServerOnlyClass for invalid side CLIENT } } This leads me to believe @SideOnly(Side.SERVER) doesn't behave the way I expected. How does that annotation work? I can't mark stuff as server only at all?
  12. I want a block like a BuildCraft pipe. It is centered on all 3 axis. The block should not touch ground or ceiling. It's hard to explain unless you see one of those pipes.
  13. Yes but I'm not sure how it works. Currently, after what you said, I'm gonna try this approach: class MyWorldData extends WorldSavedData { private static final HashMap<String, Position> map = new HashMap<String, Position>(); public MyWorldData () { super("myworlddata"); } public MyWorldData (String s) { super(s); } public static MyWorldData get(World world) { MapStorage storage = world.perWorldStorage; MyWorldData instance = (MyWorldData) storage.loadData(MyWorldData .class, "myworlddata"); if (instance == null) { instance = new MyWorldData(); storage.setData("myworlddata", instance); } return instance; } @Override public void readFromNBT(NBTTagCompound nbt) { map.clear(); NBTTagList list = nbt.getTagList("map", NBT.TAG_COMPOUND); int listSize = list.tagCount(); for(int i = 0; i < listSize; ++i) { NBTTagCompound listItem = list.getCompoundTagAt(i); String key= listItem.getString("key"); int x = listItem.getInteger("x"); int y = listItem.getInteger("y"); int z = listItem.getInteger("z"); Position pos = new Position(x, y, z); map.put(name, pos); } } @Override public void writeToNBT(NBTTagCompound nbt) { NBTTagList list = new NBTTagList(); map.forEach((name, pos) -> { NBTTagCompound listItem = new NBTTagCompound(); listItem.setString("name", name); listItem.setInteger("x", pos.getX()); listItem.setInteger("y", pos.getY()); listItem.setInteger("z", pos.getZ()); list.appendTag(listItem); }); nbt.setTag("map", list); } public boolean contains(String key) { return map.containsKey(key); } public boolean add(String key, int x, int y, int z) { if(key == null || key.length() < 1) { return false; } if(!map.containsKey(key)) { map.put(key, new Position(x, y, z)); this.markDirty(); return true; } else { return false; } } public boolean rename(String key, String newKey) { if(key == null || key.length() < 1 || newKey == null || newKey.length() < 1) { return false; } Position pos = map.remove(key); if(pos == null) { return false; } else { map.put(newKey, pos); return true; } } public Position get(String key) { return map.get(key); } public Position remove(String key) { Position pos = map.remove(key); if(pos != null) this.markDirty(); return pos; } } public class MyTileEntity extends TileEntity { private String key = null; public boolean containsKey(String key) { MyWorldData wd = MyWorldData.get(this.worldObj); return wd.contains(key); } public boolean setKey(String key) { MyWorldData wd = MyWorldData.get(this.worldObj); if(wd.contains(key)) return false; if(this.key == null) { this.key = key; return wd.add(key, xCoord, yCoord, zCoord); } else { wd.rename(this.key, key); this.key = key; return true; } } public String getKey() { return this.name; } @Override public boolean canUpdate() { return false; } @Override public Packet getDescriptionPacket() { NBTTagCompound nbtTagCompound = new NBTTagCompound(); writeToNBT(nbtTagCompound); int metadata = getBlockMetadata(); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, metadata, nbtTagCompound); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { readFromNBT(pkt.func_148857_g()); } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.key = nbt.getString("key"); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setString("name", this.key); } public static MyTileEntity getByKey(String key, World world) { MyWorldData wd = MyWorldData .get(world); Position pos = wd.get(key); TileEntity te = world.getTileEntity(pos.getX(), pos.getY(), pos.getZ()); if(te instanceof MyTileEntity) return (MyTileEntity)te; else return null; } } I was trying to add unnamed TileEntities to my map and this was getting really complicated. Will this version of the code work now?? I only add a TileEntity to the map once the player gives it a name. One last thing: from where should I invoke WorldSavedData#remove ? Block.breakBlock ?
  14. Because the player only needs to set the name once. Then it's supposed to be saved forever, unless the player wants to change it. I want to persist the HashMap<String, Position> through game sessions. Is there a better method I can use so I can have direct access to the TileEntity?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.