Skip to content

Commit

Permalink
add-ons seem to work correctly now.
Browse files Browse the repository at this point in the history
time to go get food and wait for someone to break it faster than i can cook
  • Loading branch information
EternalBlueFlame committed Sep 27, 2024
1 parent 871e500 commit 79be692
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/main/java/ebf/tim/api/TransportSkin.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ebf.tim.api;
@Deprecated

public class TransportSkin {
String addr;
public TransportSkin(String modID, String a, String b, String c){ addr= b;}
public TransportSkin(String modID, String a, String b, String c){ addr= modID+":"+a;}
@Deprecated//todo!
public TransportSkin setRecolorsFrom(int i){return this;}
@Deprecated//todo!
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/train/client/gui/GuiPaintbrushMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ebf.tim.api.SkinRegistry;
import ebf.tim.utility.DebugUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
Expand Down Expand Up @@ -84,7 +85,6 @@ public class GuiPaintbrushMenu extends GuiScreen {
private final int totalOptions;
private int currentDisplayTexture = 0;
private final AbstractTrains renderEntity;
private final TrainRecord record;
private boolean doAnimation;
private static Integer activeButtonID;
private int descriptionScrollerIndex = 0;
Expand All @@ -111,10 +111,9 @@ public GuiPaintbrushMenu(EntityPlayer editingPlayer, EntityRollingStock rollingS
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
record = rollingStock.getSpec();
totalOptions = SkinRegistry.get(rollingStock).size();
for (int i = 0; i < totalOptions; i++) { // Set page to the page with the currently selected texture.
if (record.getLiveries().get(i).equals(rollingStock.getColor())) {
if (SkinRegistry.get(rollingStock).get(i).equals(rollingStock.getColor())) {
currentDisplayTexture = i;
break;
}
Expand Down Expand Up @@ -304,7 +303,7 @@ public void drawScreen(int mouseX, int mouseY, float par3) {
String loopRenderColor;
if (renderModels) {
// Rolling stock pieces with more than one bogie need offset based on bogie position to render properly.
float bogieOffset = (float) Math.abs(record.getBogieLocoPosition()) * 0.5f;
float bogieOffset = Math.abs(rollingStock.rotationPoints()[0]) * 0.5f;
float offsetX = GUI_ANCHOR_X;
float offsetY = GUI_ANCHOR_Y + 10;
// Display the model with each texture.
Expand All @@ -314,11 +313,11 @@ public void drawScreen(int mouseX, int mouseY, float par3) {
int endIndex = hasNextTexture ? 1 : 0;
for (int i = startIndex; i <= endIndex; i++) {
if (i + currentDisplayTexture != -1 && i + currentDisplayTexture != totalOptions) {
loopRenderColor = record.getLiveries().get(i + currentDisplayTexture);
loopRenderColor = SkinRegistry.get(rollingStock).get(i + currentDisplayTexture);
} else if (i + currentDisplayTexture == -1) {
loopRenderColor = record.getLiveries().get(totalOptions - 1);
loopRenderColor = SkinRegistry.get(rollingStock).get(totalOptions - 1);
} else {
loopRenderColor = record.getLiveries().get(0);
loopRenderColor = SkinRegistry.get(rollingStock).get(0);
}
renderEntity.setColor(loopRenderColor);
GL11.glColor4f(1, 1, 1, 1);
Expand Down Expand Up @@ -573,11 +572,11 @@ public void handleMouseInput() {
int i = Mouse.getEventDWheel();
if(i!=0){
//handle scrolling through the dropdown
if(drawList) {
handleMenuScroll(i);
}
if(drawList) {
handleMenuScroll(i);
}
}
//desc box scroll here
//desc box scroll here
super.handleMouseInput();
}
@Override
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/train/common/items/ItemRollingStock.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public ItemRollingStock(String iconName, CreativeTabs tab) {

public ItemRollingStock(AbstractTrains train, String modid, CreativeTabs tab){
this(modid+"."+train.transportName(),tab);
setUnlocalizedName(train.transportName());
entity=train;
}

Expand Down Expand Up @@ -129,10 +130,10 @@ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlaye
s.append(": ");
if (getEntity() instanceof Locomotive){
s.append(t("menu.item.locomotive")+", ");
if(entity instanceof IPassenger){
if(entity.getRiderOffsets().length>1){
s.append(t("menu.item.passenger")+", ");
}
if(entity instanceof Freight){
if(entity.getInventoryRows()>0){
s.append(t("menu.item.freight")+", ");
}
} else {
Expand Down Expand Up @@ -291,8 +292,8 @@ public EntityMinecart placeCart(EntityPlayer player, ItemStack itemstack, World


try {
rollingStock=getEntity().getClass().getConstructor(World.class, double.class, double.class, double.class)
.newInstance(world, i + 0.5D, j, k + 0.5D);
rollingStock=getEntity().getClass().getConstructor(World.class)
.newInstance(world);
} catch (Exception e){
if(DebugUtil.dev){
e.printStackTrace();
Expand All @@ -302,6 +303,7 @@ public EntityMinecart placeCart(EntityPlayer player, ItemStack itemstack, World


if (rollingStock != null) {
rollingStock.setPosition( i + 0.5D, j, k);
if (SkinRegistry.get(rollingStock).size()>0) {
rollingStock.setColor(rollingStock.getDefaultSkin());
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/train/common/library/TraincraftRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ public float[] getRotate() {

@Override
public float[] getScale() {
return new float[]{0.625f,0.625f,0.625f};
return new float[]{1,1,1};
}

@Override
public ResourceLocation getTextureFile(String colorString) {
return null;
return new ResourceLocation(colorString);
}

@Override
Expand Down

0 comments on commit 79be692

Please sign in to comment.