Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paint bucket addition; dupe fix #673

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/ebf/tim/entities/GenericRailTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
29 changes: 25 additions & 4 deletions src/main/java/ebf/tim/gui/GUIPaintBucket.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down
Loading