Minecraft
Simple Minecraft-inspired program using Python and Pyglet
The only model I'm familiar with is diffuse lighting but this look way more complicated than that.
Source: (StackOverflow)
I'm trying to write a handler/controller for the Minecraft server. My problem is that I can't seem get writing and reading to work properly. When a client issues a command that uses the server class's method serverCom
, the Minecraft server's text/log starts to come into the Python window/Python console and the connected client hangs. Also, it seems that after I use Popen
, the Minecraft server doesn't really launch until I do write to the server (aka serverCom
method). In case anyone is wondering, the Popen
goes to a batch file that opens the .jar file. This is on Windows XP.
import subprocess
import os
import configobj
import socket
import threading
from time import sleep
config = configobj.ConfigObj("config.ini")
cHost = config["hostip"]
cPort = int(config["hostport"])
cBuffer = int(config["serverbuffer"])
cClients = int(config["numberofclients"])
cPassword = config["password"]
class server(object):
def __init__(self):
self.process = False
self.folder = "C:\\servers\\minecraft-danny"
self.max = configobj.ConfigObj("%s\\simpleserver.properties"%self.folder)["maxPlayers"]
def serverStart(self):
if not self.process:
self.process = subprocess.Popen("java -Xmx1024m -Xms1024m -jar minecraft_server.jar nogui", cBuffer, None, subprocess.PIPE, subprocess.PIPE, subprocess.STDOUT, cwd = self.folder)
return True
return False
def serverStop(self):
if self.process:
self.serverCom("stop")
self.process = False
return True
return False
def serverCom(self, text):
if self.process:
self.process.stdout.seek(2)
self.process.stdin.write("%s\n"%text)
self.process.stdin.flush()
self.process.stdout.flush()
return (str(self.process.stdout.readline()), True)
return ("", False)
def serverPlayers(self):
if self.process:
self.serverCom("list")
x = self.serverCom(" ")[0].split(":")[3].replace("\n","").replace(" ","")
if x == "":
x = 0
else:
x = len(x.split(","))
return (x, self.max)
return (0,self.max)
serv = server()
def client(cnct, adr):
global count
try:
dat = str(cnct.recv(cBuffer)).split(" ")
ans = False
if dat[0] == "start":
print "Client %s:%s started the MC Server....."%(adr[0], adr[1])
x = serv.serverStart()
sleep(1)
serv.serverCom(" ")
serv.serverCom(" ")
sleep(5)
if x:
ans = "Server is now online."
else:
ans = "Server is already online."
elif dat[0] == "stop":
print "Client %s:%s stopped the MC Server....."%(adr[0], adr[1])
x = serv.serverStop()
sleep(6)
if x:
ans = "Server is now offline."
else:
ans = "Server is already offline."
elif dat[0] == "commun":
print "Client %s:%s executed a command on the MC Server....."%(adr[0], adr[1])
serv.serverCom(" ".join(dat[1:]))
x = serv.serverCom(" ")
if x[1]:
ans = x[0]
else:
ans = "No return text, server is offline or not responding."
elif dat[0] == "players":
print "Client %s:%s recieved the player count from the MC Server....."%(adr[0], adr[1])
pc = serv.serverPlayers()
ans = "%s/%s"%(pc[0],pc[1])
elif dat[0] == "help":
print "Client %s:%s recieved the help list....."%(adr[0], adr[1])
ans = "__________\nstart - Starts the server.\nstop - Stops the server.\ncommun <command> - Writes to server's console.\nplayers - Returns player count.\nhelp - Shows this help.\nclose - Closes client connections.\n__________"
elif dat[0] == "close":
pass
else:
ans = "Command '%s' is not valid."%dat[0]
if ans:
cnct.send("PASS")
cnct.send("%s\n"%ans)
threading.Thread(target = client, args = (cnct, adr,)).start()
else:
cnct.send("DICN")
cnct.send("Connection to server closed.\n")
cnct.close()
print "Client %s:%s disconnected....."%(adr[0], adr[1])
if count:
count -= 1
except:
cnct.close()
print "Client %s:%s disconnected..... "%(adr[0], adr[1])
if count:
count -= 1
print "-MC Server Control Server v0.0.1 BETA-"
print "Starting up server....."
print "Connecting to socket....."
count = 0
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sck.bind((cHost, cPort))
sck.listen(5)
print "Connected and listening on %s:%s....."%(cHost, cPort)
print "Setting up client listener, allowing %s clients to connect at a time....."%cClients
while True:
for x in range(cClients):
(cnct, adr) = sck.accept()
print "Client %s:%s connected....."%(adr[0], adr[1])
cnct.send("Welcome to MineCraft Server Control.\n\nPlease enter server control password.\n")
ps = str(cnct.recv(cBuffer))
if count < cClients:
if ps == cPassword:
cnct.send("CRRT")
cnct.send("%s was correct.\nIf you need help type 'help'."%ps)
count += 1
threading.Thread(target = client, args = (cnct, adr,)).start()
else:
cnct.send("WRNG")
cnct.send("%s wasn't the correct password, please try again."%ps)
cnct.close()
print "Client %s:%s rejected....."%(adr[0], adr[1])
else:
cnct.send("WRNG")
cnct.send("Too many clients connected to MineCraft Server Control")
cnct.close()
print "Client %s:%s rejected....."%(adr[0], adr[1])
sck.close()
Source: (StackOverflow)
As I am writing a simple Minecraft server application in Erlang, I am now concerned with the question of how to efficiently store and modify chunk data.
For those who don't know about Minecraft's internals: I need to store a lot of binaries (100-1000) of up to 32kB size in memory. Until this point Erlang's builtin binaries are sufficient. But the server has to read and change some bytes (by their id) in these binaries quite often and I don't want to copy them around all the time.
A nice to have feature would be import and export from/to Erlang's standard binaries.
Is there any Erlang extension or database or whatever I could use for this?
Source: (StackOverflow)
I recently watched a bit of Notch's Ludum Dare live stream. He uses Eclipse's hotswap feature extensively while he works on his game. (here is a video of what I am referring to http://www.twitch.tv/notch/b/302823358?t=86m30s)
I would like to do the same with C# and XNA. Fortunately, Visual Studio has an Edit and Continue feature. However, I would like to edit my rendering code while it is running instead of pausing it.
Is it possible for me to setup Visual Studio to do the same? I noticed that there is a checkbox for Break all processes when one process breaks
. Is it maybe possible to set up my rendering loop in another thread so that the game keeps rendering while I make a change?
Source: (StackOverflow)
Important note: This question is NOT about geometry culling (frustrum culling, back face culling, occlusion culling or any of their friends.) This question is about geometry elimination at set-up time, long before we get to culling and rendering.
In a unit-cube rendered world (a la MineCraft), I'm trying to find algorithms for how to remove from my list of geometry faces that can't possibly be seen from any angle, no matter where the camera is.
For example, imagine 2 squares:
+----+ +----+
| | | |
| | | |
+----+ +----+
clearly there are 8 visible sides (4 on each square.) Now I move the squares together, vis:
+----+----+
| |
| |
+----+----+
Rather than having 8 sides, now I only have 6! The two that are touching in the middle can't be seen, no matter where the camera is placed, nor what angle it is facing. (The squares are textured differently, so we can't call it 4 sides.)
(The same thing works in 3D with cubes, but 12 faces (6 per cube) become 10 as the 2 touching are eliminated.)
My question is: what are some algorithms that help me to recognize these hidden faces? (I'm happy to do my own Googling, but I don't even know what this is called!) In particular, I'm looking for something that handles hollow spots in the middle -- spots which COULD be visible if you were in there but, because they're surrounded by geometry, you can't see them.
For example:
+----+----+----+----+
| |
| |
+ +----+ +
| | | |
| | A | |
+ +----+ +
| |
| |
+----+----+----+----+
In this case, one might think there 18 "visible" sides but, because we know for a fact that the camera is outside of the geometry, the 4 sides in square "A" aren't visible.
To further complicate things, I'm hoping to find an algorithm that can make quick updates if a block is added or removed (again, a la MineCraft.)
Thanks!
Source: (StackOverflow)
How would I terminate a Lua script? Right now I'm having problems with exit(), and I don't know why. (This is more of a Minecraft ComputerCraft question, since it uses the APIs included.) Here is my code:
while true do
if turtle.detect() then
if turtle.getItemCount(16) == 64 then
exit() --here is where I get problems
end
turtle.dig() --digs block in front of it
end
end
Source: (StackOverflow)
I can wrap my head around using a 2D Perlin noise function to generate the height value but I don't understand why a 3D Perlin noise function would be used. In Notch's blog, he mentioned using a 3D Perlin noise function for the terrain generation on Minecraft. Does anyone know how that would be done and why it would be useful? If you are passing x
, y
, and z
values doesn't that imply you already have the height?
Source: (StackOverflow)
First,
I want to indicate that I know that any information sent from the client cannot be trusted as it can be spoofed. I am interested in methods of security through obscurity to deter 99.9% of potential cheaters and ability to detect programs that do get around the security in real time.
Some ideas I had for this included verifying file and memory check-sums of both the game it is securing and also any potential cheat apps by allowing the client-side to scan on request from the server (via TCP), both for detecting memory injection cheats and or a cheats memory footprint. Therefore the bypass hack would have to listen for all TCP information being sent to it on SSL, and then unencrypt the message by disassembling the encryption/decryption function to understand what it wants. Similarly, the client itself may be self changing and allow for it to add/remove features as needed at random (but keep by the server) so that it would be hard for a cheat to learn how to bypass it. This may be pointless?
I only find this to be moderately difficult for the more experienced, so I am open to other methods that may be hard to bypass.
I am only interested in possible implementations and not how it's impossible to have a client-side anticheat, I just want to make it really really hard.
Added minecraft and java tag, and it's for Minecraft, and I know the community is large enough that someone is likely to beat my system, but I hope through the use of constant updates and changes that I can beat them through ingenuity and perseverance.
Edit: I found this post: How to prevent cheating in our (multiplayer) games? and I am adding his suggestions so not to duplicate things, as I am looking for more ideas than the obvious (and I am not sure if his aren't bypassable)
1) Open all other processes, and hook their WriteProcessMemory functions so that they can't write to the memory in your game's
process. Done right this one step will block 90% of all cheats and
cheat engines.
2) Do the same thing, hooking the various mouse and keyboard emulation
functions. This will prevent a lot of aimbots and other types of
automation bots.
3) Hook into the VirtualProtectEx/VirtualAllocEx/etc functions in your
game's own process and monitor which modules are changing protection
levels or allocating new memory chunks. You have to be crafty with
this in order to prevent it from being too CPU intensive when your
game does a lot of allocations, but it can be done.
4) Hook into the LoadLibrary functions and monitor any DLLs that are
being loaded dynamically, to prevent DLL injection.
5) Use some lightweight polymorphic encoding on your game connections.
6) Use some anti-debugging techniques to prevent debuggers from
attaching to your processes. Google anti-debugging and you should be
able to find lots of stuff.
7) Use a custom proprietary PE packer to prevent useful disassembly of
your game.
8) Hook into your OpenGL or Direct3D functions and methods that deal
with transparency and alpha blending.
9) If using shaders, checksum your shaders and the shader constant
values.
10) Use additional occlusion culling techniques on player characters
to prevent them from being rendered at all when the line of sight to
them is blocked by other geometry. It may or may not help with your
performance also, but it will prevent many wallhacks.
Source: (StackOverflow)
Hello everyone I know my title sounds stupid but it is a legitimate question and I will explain my position entirely.
I own the domain "Arboristal.com". I also own all sub domains privately on arboristal.com. Such as lg.arboristal or ft.arboristal.com.
Under my DNS settings, Arboristal.com is set to go to our web host who is currently hosting our website.
I have three servers running at my house all running under one public IP address. (71.82.237.27)
I also have three subdomains of Arboristal.com pointing towards my IP address.
Each of the three servers run on their own ports (25565, 25566, 25567)
I want for each subdomain to point to each open port on my IP Address.
Unfortunately when you try to connect to one of these servers using one of the subdomains it only connects to the server that you type the port for.
My situation:
Three servers, each running on a different port. (All portforwarded and working as servers)
Minecraft server one (25565)
Minecraft server two (25566)
Minecraft server three (25567)
I have three subdomains running on my DNS provider (webs.com)
mc.arboristal.com
tekkit.arboristal.com
pvp.artboristal.com
When you use Minecraft to connect to one of these it does automatically through port 25565, meaning that no matter what URL you attempt to connect to it always goes to my IP with the port 25565. Connecting you to Minecraft server one. You CAN type in the port manually, but I would rather keep this as good looking and professional as possible.
So, now that you know my situation, is there any possible way I can make mc.arboristal.com, tekkit.arboristal.com, and pvp.arboristal.com all go to my IP address under different ports without having to specify each port in the provided URL to connect to on the users end?
I can add MX, A (Using this one to connect to the server), CNAME, and TXT records to DNS settings
I can also add Name Servers to DNS settings if I need to use a third party as my DNS provider. (Am willing to do if necessary)
I also have full access to my router at 192.168.0.1 if anything needs to be configured there.
I have only just learned how the internet really functions in the last week so I am unsure if anything here is actually possible. I also may not have the right information about how the internet actually works. Please forgive me for any false information that I may assume about the internet.
Thanks in advance for your time, I hope my question is not too confusing/difficult to answer.
Source: (StackOverflow)
I have been working hard on a Python-based Minecraft server proxy. I have followed the information here, yet I still seem to get more data then I asked for. The problem occurs right after I send the packet 0xCD
with a single byte of 0. Logically, the next packet from the server should be a 0x01
login. However, I end up with a large amount of seemingly random data between the send and the 0x01
packet ID. What is up?
All my code is located here:
https://github.com/meta1203/MetaProxy
Thanks!
Source: (StackOverflow)
I have been experiencing an odd bug in my Spigot/Bukkit plugin lately which totally does not make any sense. Please note that this question may be long due to the fact that the project I am working on is fairly big and since the source code (provided below) contains classes that will not be included here I will try my best to describe my problem.
In Minecraft, using Bukkit API you can create graphical menus (GUI's) in which you can place items in certain slots and when clicked, you can adjust your functionality.
In my case, I have created the Menu
foundation class which contains basic methods for the creation of such a menu. Then, the PurchaseMenu
which extends the Menu class is used to trigger functionality in specific locations to simulate a transaction for product that can be clicked from the menu.
In depth, the menu I will include contains "Kit" displays (like game classes) that when one Left-Click's the display the player can buy it, or if it's already bought, the player will just select that kit for use. When one Right-Clicks's the display, the player can level up the kit up to 3.
In both cases a transaction menu must be popped up in order to buy or level up the clicked kit. My design is really straight forward, by passing the clicked kit from the constructor on each PurchaseMenu
class.
The problem on all the above is that the Kit is passed correctly from the constructor, but the kit that is actually being bought or level up is a random one (obviously not, but haven't found any evidence yet) and that usually happens after some tries.
My Design:
- Each Menu class contains two methods.
InventoryClick
is called when a menu display is clicked (interacted). InventoryConstruct
is called when a menu is being created (opened).
- The Purchase Menu class contains two methods as well.
PurchaseProduct
is called when a display is purchased successfully. PrePaymentChecks
is necessary checks that need to be ran before the purchase.
My questions:
- How do I patch that problem, and save the correct Kit in a private field of the class?
- How can I improve my design (approach) in certain projects to avoid such problems?
Any form of help is appreciated, I hope I described my problem in detail, if you require any further source code, please post a comment below.
Update
Because of the fact that the question will be more than 30k characters, I uploaded the whole project into a Git repository.
https://github.com/parat26/core
Menu.java: https://github.com/parat26/core/blob/master/src/src/ares/core/menu/Menu.java
PurchaseMenu.java:https://github.com/parat26/core/blob/master/src/src/ares/core/menu/PurchaseMenu.java
BattleOptionsMenu.java: https://github.com/parat26/core/blob/master/src/src/ares/core/menu/type/MenuBattleOptions.java
PurchaseMenuKit.java:
https://github.com/parat26/core/blob/master/src/src/ares/core/menu/type/PurchaseMenuKit.java
Source: (StackOverflow)
I'm helping my kid learn to create Minecraft plugins, although I don't have much experience with Java or IDEA. Everything is working well so far, but in order to execute our code, we have to:
- Make the project in IDEA (output path is set to
Bukkit/plugins
)
- Run Bukkit server
- Start Minecraft and connect
I'm not sure that anything can be done about (3), but it seems to me that IDEA should be able to handle (1) & (2) in a single step. Also, we cannot presently debug using this configuration.
In Visual Studio / .NET, I would just need to specify the executable -- java/craftbukkit, in this case -- as an "external program", and it would solve all of these problems. In IDEA, though, it seems that I am supposed to add a Run Configuration, and I don't see an option which allows anything like a "host application." Instead, it wants the full classpath to the main
for Bukkit, and it isn't clear to me what that would be. I have also seen it suggested elsewhere that even this won't work without a debug build of Bukkit. but I don't really want to debug Bukkit; I just want to debug our plugin code only.
I found these instructions for remote debugging Bukkit plugins, but is that actually necessary? It doesn't solve the "two steps to run" problem; it actually makes it worse!
Source: (StackOverflow)
I'm running Minecraft under Linux, which involves running an executable .jar file. This means it shows up as "java" under ps, rather than "minecraft". I would like to assign it the process name "minecraft".
Looking around, I found the following tip for assigning a process name via bash:
how to change the name of a Java application process?
exec -a goodname java ...
I usually run with:
java -cp ~/Games/Minecraft/Minecraft.jar net.minecraft.LauncherFrame
So tried make a bash script:
#!/bin/bash
exec -a minecraft java -cp ~/Games/Minecraft/Minecraft.jar net.minecraft.LauncherFrame
But when I run this, it still shows up as "java" under the ps command.
What am I doing wrong?
Source: (StackOverflow)
I'm making a text-based radar for Minecraft. If a player comes within 20 blocks of you, it will say in chat. As of now, it spams the chat. How can I get it to only write to chat about that player ONCE? Even if you don't play the game, it should be easy to understand.
if (Camb.radar)
{
for (Entity e: (List < Entity > ) mc.theWorld.loadedEntityList)
{
if (e instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) e;
if (player == mc.thePlayer || mc.thePlayer.getDistanceToEntity(e) > 20.0)
continue;
mc.thePlayer.addChatMessage("\2479[CAMB] \247e" + player.getEntityName() + " has entered your 20 block radius!"); //Write to chat, only want this line done once for every player
}
}
}
Source: (StackOverflow)
I am trying to open up my inventory whenever I pick up an item. This is in Bukkit.
Here is the event so far, the arguments for player.openInventory
are empty.
@EventHandler
public void blank(PlayerDropItemEvent e){
Player player = e.getPlayer();
player.openInventory();
}
Source: (StackOverflow)