diff --git a/src/main/java/ebf/tim/entities/GenericRailTransport.java b/src/main/java/ebf/tim/entities/GenericRailTransport.java index 5696bc28a0..9efe27e47e 100644 --- a/src/main/java/ebf/tim/entities/GenericRailTransport.java +++ b/src/main/java/ebf/tim/entities/GenericRailTransport.java @@ -122,7 +122,7 @@ public class GenericRailTransport extends EntityMinecart implements IEntityAddit /**calculated movement speed, first value is used for GUI and speed, second is used for render effects.*/ @Deprecated //TODO: value 1 gets the number right more often, but value 2 gets direction right. HOW public float[] velocity=new float[]{0,0}; - public int forceBackupTimer =0, syncTimer=0; + public int forceBackupTimer =0, syncTimer=0, deathTick=0; public float pullingWeight=0; private float ticksSinceLastVelocityChange=1; @@ -636,7 +636,8 @@ public boolean attackEntityFrom(DamageSource damageSource, float p_70097_2_){ } //on Destruction - if (health<1 && !getWorld().isRemote){ + if (health<1 && !getWorld().isRemote && deathTick==0){ + deathTick=this.ticksExisted; //since it was a player be sure we remove the entity from the logging. ServerLogger.deleteWagon(this); //be sure we drop the inventory items on death. diff --git a/src/main/java/ebf/tim/gui/GUIPaintBucket.java b/src/main/java/ebf/tim/gui/GUIPaintBucket.java index 0e1871ff71..220cdd548a 100644 --- a/src/main/java/ebf/tim/gui/GUIPaintBucket.java +++ b/src/main/java/ebf/tim/gui/GUIPaintBucket.java @@ -2,6 +2,7 @@ import ebf.tim.TrainsInMotion; +import ebf.tim.api.SkinRegistry; import ebf.tim.api.TransportSkin; import ebf.tim.entities.GenericRailTransport; import ebf.tim.networking.PacketPaint; @@ -18,10 +19,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.util.glu.Project; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; +import java.util.*; /** *@author Oskiek @@ -67,6 +65,8 @@ public int compare(TransportSkin o1, TransportSkin o2) { skinList.add(s.modid + ":" + s.name); } } + currentTransportSkin = entity.getCurrentSkin(); + page = skinList.indexOf(currentTransportSkin.modid + ":" + currentTransportSkin.getName()); } Keyboard.enableRepeatEvents(true); @@ -183,6 +183,27 @@ public void onClick() { public FontRenderer getFont(){return fontRendererObj;} } ); + buttonList.add( + new GUIButton(percentLeft(83) - 61, percentTop(56), 40, 20, "Random") { + @Override + public String getHoverText() { + return "Randomize Skin"; + } + + @Override + public void onClick() { + TransportSkin random = SkinRegistry.getTransportSkins(entity.getClass()).get(SkinRegistry.getTransportSkins(entity.getClass()).keySet().toArray()[new Random().nextInt(SkinRegistry.getTransportSkins(entity.getClass()).keySet().size())]); + page = skinList.indexOf(random.modid + ":" + random.getName()); + TrainsInMotion.keyChannel.sendToServer(new PacketPaint(skinList.get(page), entity.getEntityId())); + mc.displayGuiScreen(null); + } + + @Override + public FontRenderer getFont() { + return fontRendererObj; + } + } + ); break; } }