Skip to content

Commit

Permalink
Fixed problem with placing carts in SMP
Browse files Browse the repository at this point in the history
  • Loading branch information
Vswe authored and Philip Hansen committed Jun 22, 2014
1 parent 05c8b6c commit 7782d8b
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildscript {

apply plugin: 'forge'

version = "2.0.0.b11"
version = "2.0.0.dev"
group= "vswe.stevescarts" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "StevesCarts"

Expand Down
Binary file added build.lnk
Binary file not shown.
Binary file added export.lnk
Binary file not shown.
115 changes: 115 additions & 0 deletions export.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import zipfile
import glob, os
import sys
import re
import shutil

changelog = '['
first = True
isDev = False
isSecret = False
while True:
change = input("Add an updated feature: ")
if change == "done":
break
elif change == "secret":
isSecret = True;
break
elif change == "dev":
isDev = True;
break
elif change == "exit":
sys.exit(1)
else:
if not first:
changelog += ','
changelog += '"' + change + '"'
first = False
changelog += ']'


targetfolder = "../../public/"
if not isDev:
max_version = 0
for name in glob.glob(targetfolder + "StevesCarts2.0.0.b*.zip"):
shortname = os.path.basename(name)
version = shortname[18:-4]
try:
version=int(version)
except:
continue
max_version = max(max_version, version)
max_version += 1
beta = str(max_version)
version_string = "2.0.0.b" + beta;
else:
version_string = "2.0.0.dev";




#set version
gen_path = "src/main/java/vswe/stevescarts/Helpers/GeneratedInfo.java";

info = open(gen_path, "r")
content = info.read()
info.close()

content = re.sub('/\*@v\*/"2\.0\.0\.((dev)|(b[0-9]+[a-z]?))";', '/*@v*/"' + version_string + '";', content)

if isDev:
inDevStr = "true"
else:
inDevStr = "false"

content = re.sub('/\*@d\*/(true|false);', '/*@d*/' + inDevStr + ';', content)

info = open(gen_path, "w")
info.write(content)
info.close()
#end set version

#set version gradle
gradle_path = "build.gradle";

info = open(gradle_path, "r")
content = info.read()
info.close()

content = re.sub('\nversion = ".*?"', '\nversion = "' + version_string + '"', content)

info = open(gradle_path, "w")
info.write(content)
info.close()
#end set version gradle



os.system("build.LNK")


src = "build/libs/StevesCarts-" + version_string + ".jar"
target = targetfolder + "StevesCarts" + version_string + ".jar"


shutil.copyfile(src, target)


if not isDev:
download_path = targetfolder + "DownloadInfo.js";
info = open(download_path, "r")
content = info.read()
info.close()

prefix = ''
if isSecret:
prefix = '//'

content = re.sub('//@Expand', '//@Expand\n' + prefix + 'addVersionB("' + beta + '", ' + changelog + ');', content)

info = open(download_path, "w")
info.write(content)
info.close()



12 changes: 6 additions & 6 deletions src/main/java/vswe/stevescarts/Carts/MinecartModular.java
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ protected void func_145821_a(int par1, int par2, int par3, double par4, double p
}else{
super.func_145821_a(par1, par2, par3, par4, par6, par8, par9);
}

double d2 = this.pushX * this.pushX + this.pushZ * this.pushZ;

if (d2 > 1.0E-4D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D)
Expand Down Expand Up @@ -2334,7 +2334,7 @@ public boolean canRiderInteract() {
@SideOnly(Side.CLIENT)
private MovingSound soundRiding;
@SideOnly(Side.CLIENT)
private int keepSilent = -1;
private int keepSilent;
@SideOnly(Side.CLIENT)
public void setSound(MovingSound sound, boolean riding) {
if (riding) {
Expand All @@ -2346,18 +2346,18 @@ public void setSound(MovingSound sound, boolean riding) {

@SideOnly(Side.CLIENT)
public void silent() {
keepSilent = 5;
keepSilent = 6;
}
@SideOnly(Side.CLIENT)
private void updateSounds() {
if (keepSilent > 0) {
if (keepSilent > 1) {
keepSilent--;
stopSound(sound);
stopSound(soundRiding);
sound = null;
soundRiding = null;
}else if(keepSilent == 0) {
keepSilent = -1;
}else if(keepSilent == 1) {
keepSilent = 0;
Minecraft.getMinecraft().getSoundHandler().playSound(new MovingSoundMinecart(this));
Minecraft.getMinecraft().getSoundHandler().playSound(new MovingSoundMinecartRiding(Minecraft.getMinecraft().thePlayer, this));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/vswe/stevescarts/Helpers/GeneratedInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

public class GeneratedInfo {
public static final String version = /*@v*/"2.0.0.b11";
public static final boolean inDev = /*@d*/false;
public static final boolean inDev = /*@d*/true;
}
Empty file.

0 comments on commit 7782d8b

Please sign in to comment.