Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/1.9.4' into 1.10.2
Browse files Browse the repository at this point in the history
Conflicts:
	gradle.properties
  • Loading branch information
Kamesuta committed Oct 5, 2016
2 parents cc78fa0 + 35a967b commit 9bac5ae
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 64 deletions.
9 changes: 7 additions & 2 deletions TASK.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _If you have any idea for this project, please make an issue and post to this pr
- [x] Auto Sign Create GUI
- [ ] Auto Image Upload to online such as Gyazo
- [ ] 短縮URL bitly, goo.gl...
- [ ] Config
- [x] Config
- [x] Blend func problem (transparent png, playernames...)
- [x] Thread Pool
- [x] Load Faster
Expand All @@ -14,4 +14,9 @@ _If you have any idea for this project, please make an issue and post to this pr
- [x] テキストボックスメタ情報優先化
- [x] 回転構文
- [x] PlaceModeリフレクションエラーの時のPlaceモード使用不可表示
- [ ] Waila
- [ ] Waila
- [ ] ロードリトライ
- [ ] 制限プラグイン
- [ ]
- [ ] チャット画像
- [ ] アイテム画像変更
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ modid=signpic
modname=SignPicture
version_major=2
version_minor=3
version_micro=0
version_micro=1
version_minecraft=1.10.2
version_forge=12.18.1.2011
version_minforge=12.18.1.2011
Expand Down
32 changes: 17 additions & 15 deletions info/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,34 @@
}
},
"1.8.9": {
"version": "2.2.2",
"remote": "https://github.com/Team-Fruit/SignPicture/releases/download/1.8.9-2.2.2/SignPicture-1.8.9-2.2.2-universal.jar",
"local": "SignPicture-1.8.9-2.2.2-universal.jar",
"message": "Offset And Rotations! More freely images! SignPicture 2.2.2 Released!",
"version": "2.3.0",
"remote": "https://github.com/Team-Fruit/SignPicture/releases/download/1.8.9-2.3.0/SignPicture-1.8.9-2.3.0-universal.jar",
"local": "SignPicture-1.8.9-2.3.0-universal.jar",
"message": "Config & Prevent Anti-AutoSign Mode added. SignPicture 2.3.0 Released.",
"message_local": {
"ja_JP": "オフセットと回転機能実装! さらに自由自在に画像を貼ろう! SignPicture 2.2.2 リリース!"
"ja_JP": "Anti-AutoSign回避モードとコンフィグの追加 SignPicture 2.3.0 リリース!"
}
},
"1.9.4": {
"version": "2.1.5",
"remote": "https://github.com/Team-Fruit/SignPicture/releases/download/1.9.4-2.1.5/SignPicture-1.9.4-2.1.5-universal.jar",
"local": "SignPicture-1.9.4-2.1.5-universal.jar",
"message": "GUI Update! SignPicture 2.1.5 Released!",
"version": "2.3.0",
"remote": "https://github.com/Team-Fruit/SignPicture/releases/download/1.9.4-2.3.0/SignPicture-1.9.4-2.3.0-universal.jar",
"local": "SignPicture-1.9.4-2.3.0-universal.jar",
"message": "Config & Prevent Anti-AutoSign Mode added. SignPicture 2.3.0 Released.",
"message_local": {
"ja_JP": "遂にSignPictureにGUIが! SignPicture 2.1.5リリース!!"
"ja_JP": "Anti-AutoSign回避モードとコンフィグの追加 SignPicture 2.3.0 リリース!"
}
},
"1.10.2": {
"version": "2.1.5",
"remote": "https://github.com/Team-Fruit/SignPicture/releases/download/1.10.2-2.1.5/SignPicture-1.10.2-2.1.5-universal.jar",
"local": "SignPicture-1.10.2-2.1.5-universal.jar",
"message": "GUI Update! SignPicture 2.1.5 Released!",
"version": "2.3.0",
"remote": "https://github.com/Team-Fruit/SignPicture/releases/download/1.10.2-2.3.0/SignPicture-1.10.2-2.3.0-universal.jar",
"local": "SignPicture-1.10.2-2.3.0-universal.jar",
"message": "Config & Prevent Anti-AutoSign Mode added. SignPicture 2.3.0 Released.",
"message_local": {
"ja_JP": "遂にSignPictureにGUIが! SignPicture 2.1.5リリース!!"
"ja_JP": "Anti-AutoSign回避モードとコンフィグの追加 SignPicture 2.3.0 リリース!"
}
}
},
"website": "https://github.com/Kamesuta/SignPicture/",
"changelog": "https://github.com/Kamesuta/SignPicture/releases",
"private_msg": "http://fruit.bebehp.com/signpic.php/msg?id=%id%&name=%name%&vmod=%modversion%&vmodmc=%modmcversion%&vmodforge=%modforgeversion%&vmc=%mcversion%&vforge=%forgeversion%"
}
4 changes: 4 additions & 0 deletions src/main/java/com/kamesuta/mc/signpic/information/Info.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

public class Info {
public Map<String, Version> versions;
public String website;
public String changelog;
public String private_msg;
public static class Version {
public String version;
public String remote;
public String local;
public String message;
public Map<String, String> message_local;
public String website;
public String changelog;
}
public static class PrivateMsg {
public boolean json;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public final class InformationChecker {
public static InfoState state = new InfoState();

public static class InfoState {
public Info info;
public Info.Version onlineVersion;
public Info.Version stableVersion;
public Info.Version unstableVersion;
Expand All @@ -31,8 +32,13 @@ public void onTick() {
final EntityPlayer player = Client.mc.thePlayer;
if(this.doneChecking && player != null && !this.triedToWarnPlayer) {
final String lang = Client.mc.gameSettings.language;
if (Config.instance.informationNotice && !StringUtils.equals(Reference.VERSION, "${version}")) {
if (this.info!=null && Config.instance.informationNotice && !StringUtils.equals(Reference.VERSION, "${version}")) {
try {
if (this.info.versions!=null) {
this.stableVersion = this.info.versions.get(Client.mcversion);
this.unstableVersion = this.info.versions.get(Client.mcversion + "-beta");
}

final String[] client = Reference.VERSION.split("\\.");
if (client.length>=3) {
final int clientBuild1 = Integer.parseInt(client[0]);
Expand Down Expand Up @@ -72,12 +78,27 @@ public void onTick() {
}

if(betaneedupdate || needupdate) {
ChatBuilder.create("signpic.versioning.outdated").setParams(Reference.VERSION, this.onlineVersion.version).useTranslation().chatClient();
if (this.onlineVersion.message_local!=null && this.onlineVersion.message_local.containsKey(lang))
ChatBuilder.create(this.onlineVersion.message_local.get(lang)).chatClient();
else if (!StringUtils.isEmpty(this.onlineVersion.message))
ChatBuilder.create(this.onlineVersion.message).chatClient();
ChatBuilder.create("signpic.versioning.outdated").setParams(Reference.VERSION, this.onlineVersion.version).useTranslation().chatClient();
ChatBuilder.create("signpic.versioning.updateMessage").useTranslation().useJson().chatClient();;

final String website;
if (this.onlineVersion.website!=null) website = this.onlineVersion.website;
else if (this.info.website!=null) website = this.info.website;
else website = "https://github.com/Kamesuta/SignPicture/";

final String changelog;
if (this.onlineVersion.changelog!=null) changelog = this.onlineVersion.changelog;
else if (this.info.changelog!=null) changelog = this.info.changelog;
else changelog = "https://github.com/Kamesuta/SignPicture/releases";

ChatBuilder.create("signpic.versioning.updateMessage").useTranslation().useJson()
.replace("$download$", "{\"action\":\"run_command\",\"value\":\"/signpic-download-latest\"}")
.replace("$website$", "{\"action\":\"open_url\",\"value\":\"" + website + "\"}")
.replace("$changelog$", "{\"action\":\"open_url\",\"value\":\"" + changelog + "\"}")
.chatClient();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,13 @@ public void run() {
final HttpResponse response = Downloader.downloader.client.execute(req);
final HttpEntity entity = response.getEntity();
input = entity.getContent();
final Info info = gson.fromJson(new JsonReader(new InputStreamReader(input, CharEncoding.UTF_8)), Info.class);
if (info!=null) {
if (info.versions!=null) {
state.stableVersion = info.versions.get(Client.mcversion);
state.unstableVersion = info.versions.get(Client.mcversion + "-beta");
}
if (!StringUtils.isEmpty(info.private_msg)) {
state.info = gson.fromJson(new JsonReader(new InputStreamReader(input, CharEncoding.UTF_8)), Info.class);
if (state.info!=null) {
if (!StringUtils.isEmpty(state.info.private_msg)) {
InputStream input1 = null;
try {
if (!StringUtils.isEmpty(Client.name) && !StringUtils.isEmpty(Client.id)) {
final String msgurl = info.private_msg
final String msgurl = state.info.private_msg
.replace("%name%", Client.name)
.replace("%id%", Client.id)
.replace("%mcversion%", Client.mcversion)
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/com/kamesuta/mc/signpic/proxy/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.File;
import java.io.IOException;
import java.util.Map;

import com.kamesuta.mc.signpic.Client;
import com.kamesuta.mc.signpic.Reference;
Expand All @@ -12,13 +11,11 @@
import com.kamesuta.mc.signpic.render.CustomTileEntitySignRenderer;
import com.mojang.util.UUIDTypeAdapter;

import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
Expand Down Expand Up @@ -108,9 +105,7 @@ public void init(final FMLInitializationEvent event) {
super.init(event);

// Replace Sign Renderer
Client.renderer.setRendererDispatcher(TileEntityRendererDispatcher.instance);
final Map<Class<? extends TileEntity>, TileEntitySpecialRenderer<? extends TileEntity>> renderers = TileEntityRendererDispatcher.instance.mapSpecialRenderers;
renderers.put(TileEntitySign.class, Client.renderer);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySign.class, Client.renderer);

// Event Register
Client.handler.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,28 +104,27 @@ public void renderSignPicture(final Entry entry, final int destroy, final float
}

public void translateBase(final TileEntitySign tile, final double x, final double y, final double z, final float rotateratio) {
// Vanilla Translate
final Block block = tile.getBlockType();
GlStateManager.pushMatrix();
final float f1 = 0.6666667F;
float f3;

if (block == Blocks.STANDING_SIGN) {
GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F * f1, (float)z + 0.5F);
final float f2 = tile.getBlockMetadata() * 360 / 16.0F;
GlStateManager.rotate(-f2, 0.0F, 1.0F, 0.0F);
} else {
final int j = tile.getBlockMetadata();
f3 = 0.0F;

if (j == 2) f3 = 180.0F;
if (j == 4) f3 = 90.0F;
if (j == 5) f3 = -90.0F;

GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F * f1, (float)z + 0.5F);
GlStateManager.rotate(-f3, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, -0.4375F);
}
// Vanilla Translate
final Block block = tile.getBlockType();
final float f1 = 0.6666667F;
float f3;

if (block == Blocks.STANDING_SIGN) {
GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F * f1, (float)z + 0.5F);
final float f2 = tile.getBlockMetadata() * 360 / 16.0F;
GlStateManager.rotate(-f2, 0.0F, 1.0F, 0.0F);
} else {
final int j = tile.getBlockMetadata();
f3 = 0.0F;

if (j == 2) f3 = 180.0F;
if (j == 4) f3 = 90.0F;
if (j == 5) f3 = -90.0F;

GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F * f1, (float)z + 0.5F);
GlStateManager.rotate(-f3, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, -0.4375F);
}
}

public void renderSignPictureBase(final TileEntitySign tile, final double x, final double y, final double z, final float partialTicks, final int destroy, final float opacity) {
Expand Down Expand Up @@ -164,6 +163,7 @@ public void renderTileEntityAt(final TileEntitySign tile, final double x, final
{
Client.startSection("signpic-render");
renderSignPictureBase(tile, x, y, z, partialTicks, destroy, 1f);
//super.renderTileEntityAt(tile, x, y, z, partialTicks, destroy);
Client.endSection();
}

Expand Down
29 changes: 25 additions & 4 deletions src/main/java/com/kamesuta/mc/signpic/util/ChatBuilder.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.kamesuta.mc.signpic.util;

import com.google.gson.JsonSyntaxException;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.google.common.collect.Maps;
import com.kamesuta.mc.signpic.Client;

import net.minecraft.client.Minecraft;
Expand All @@ -24,6 +28,7 @@ public class ChatBuilder {
private boolean useTranslation = false;
private boolean useJson = false;
private boolean useId = false;
private final Map<String, String> replace = Maps.newHashMap();
private int id = -1;

public ChatBuilder() {}
Expand All @@ -36,14 +41,20 @@ public ITextComponent build() {
else {
String s;
if (this.useTranslation) {
s = String.format(translateToLocal(this.text), this.params);
s = translateToLocal(this.text);
} else
s = this.text;

for (final Map.Entry<String, String> entry: this.replace.entrySet())
s = StringUtils.replace(s, entry.getKey(), entry.getValue());

if (this.params.length>0)
s = String.format(s, this.params);

if (this.useJson)
try {
chat = ITextComponent.Serializer.jsonToComponent(s);
} catch (final JsonSyntaxException e) {
} catch (final Exception e) {
chat = new TextComponentString("Invaild Json: " + this.text);
}
else
Expand All @@ -63,6 +74,10 @@ public static String translateToLocal(final String text) {
return net.minecraft.util.text.translation.I18n.translateToLocal(text);
}

public boolean isEmpty() {
return StringUtils.isEmpty(this.text) && (this.chat==null || StringUtils.isEmpty(this.chat.getUnformattedText()));
}

public ChatBuilder setId(final int id) {
this.useId = true;
this.id = id;
Expand Down Expand Up @@ -104,13 +119,19 @@ public ChatBuilder useJson() {
return this;
}

public ChatBuilder replace(final String from, final String to) {
this.replace.put(from, to);
return this;
}

public static ChatBuilder create(final String text) {
return new ChatBuilder().setText(text);
}

@SideOnly(Side.CLIENT)
public void chatClient() {
chatClient(this);
if (!isEmpty())
chatClient(this);
}

@SideOnly(Side.CLIENT)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/signpic/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ signpic.advmsg.unknown=Unknown Error: §7%s

# Version Checking
signpic.versioning.outdated=[§6SignPicture§r] You are running Sign Picture %s, the latest is %s.
signpic.versioning.updateMessage=["Click for... [",{"text":"Download","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to automatically download the latest version","color":"green"}},"clickEvent":{"action":"run_command","value":"/signpic-download-latest"}},"] [",{"text":"Website","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to go to the mod's website","color":"green"}},"clickEvent":{"action":"open_url","value":"https://github.com/Kamesuta/SignPicture/"}},"] [",{"text":"Changelog","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to go to the version's Changelog","color":"green"}},"clickEvent":{"action":"open_url","value":"https://github.com/Kamesuta/SignPicture/releases"}},"]"]
signpic.versioning.updateMessage=["Click for... [",{"text":"Download","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to automatically download the latest version","color":"green"}},"clickEvent":$download$},"] [",{"text":"Website","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to go to the mod's website","color":"green"}},"clickEvent":$website$},"] [",{"text":"Changelog","color":"green","hoverEvent":{"action":"show_text","value":{"text":"Click this to go to the version's Changelog","color":"green"}},"clickEvent":$changelog$},"]"]
signpic.versioning.startingDownload=[{"text":"Starting download of %s. Please do not remove your hard disk. Enjoying ","color":"aqua"}]
signpic.versioning.downloading=Now Downloading... %s%% (%s / %s bytes)
signpic.versioning.doneDownloading=Finished downloading %s. Delete your old SignPicture .jar and reload your game to update.
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/signpic/lang/ja_JP.lang
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ signpic.advmsg.unknown=不明なエラー: §7%s

# Version Checking
signpic.versioning.outdated=[§6SignPicture§r] 現在のSignPictureのバージョンは %s です。新しいバージョン %s がご利用可能です!
signpic.versioning.updateMessage=["[",{"text":"ダウンロード","color":"green","hoverEvent":{"action":"show_text","value":{"text":"自動的に最新バージョンをダウンロードします","color":"green"}},"clickEvent":{"action":"run_command","value":"/signpic-download-latest"}},"] [",{"text":"ウェブサイト","color":"green","hoverEvent":{"action":"show_text","value":{"text":"ウェブサイトへ","color":"green"}},"clickEvent":{"action":"open_url","value":"https://github.com/Kamesuta/SignPicture/"}},"] [",{"text":"チェンジログ","color":"green","hoverEvent":{"action":"show_text","value":{"text":"更新履歴を見る","color":"green"}},"clickEvent":{"action":"open_url","value":"https://github.com/Kamesuta/SignPicture/releases"}},"]"]
signpic.versioning.updateMessage=["[",{"text":"ダウンロード","color":"green","hoverEvent":{"action":"show_text","value":{"text":"自動的に最新バージョンをダウンロードします","color":"green"}},"clickEvent":$download$},"] [",{"text":"ウェブサイト","color":"green","hoverEvent":{"action":"show_text","value":{"text":"ウェブサイトへ","color":"green"}},"clickEvent":$website$},"] [",{"text":"チェンジログ","color":"green","hoverEvent":{"action":"show_text","value":{"text":"更新履歴を見る","color":"green"}},"clickEvent":$changelog$},"]"]
signpic.versioning.startingDownload=[{"text":"ダウンロード開始 %s","color":"aqua"}]
signpic.versioning.downloading=ダウンロード中... %s%% (%s / %s バイト)
signpic.versioning.doneDownloading=ダウンロード完了 %s 適用するためには古いSignPictureの.jarファイルを消し、Minecraftを再起動してください
Expand Down

0 comments on commit 9bac5ae

Please sign in to comment.