mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #1356 from MellowArpeggiation/boble
Add Mellow bobblehead
This commit is contained in:
commit
14fb890dd7
@ -192,7 +192,8 @@ public class BlockBobble extends BlockContainer implements IGUIProvider {
|
||||
DRILLGON( "Drillgon200", "Drillgon200", "1.12 Port", null, false, ScrapType.CPU_LOGIC),
|
||||
CIRNO( "Cirno", "Cirno", "the only multi layered skin i had", "No brain. Head empty.", true, ScrapType.BOARD_BLANK),
|
||||
MICROWAVE( "Microwave", "Microwave", "OC Compatibility", "they call me the food heater", true, ScrapType.BRIDGE_BIOS),
|
||||
PEEP( "Peep", "LePeeperSauvage", "Coilgun, Leadburster and Congo Lake models, BDCL QC", "Fluffy ears can't hide in ash, nor snow.", true, ScrapType.CPU_CLOCK);
|
||||
PEEP( "Peep", "LePeeperSauvage", "Coilgun, Leadburster and Congo Lake models, BDCL QC", "Fluffy ears can't hide in ash, nor snow.", true, ScrapType.CPU_CLOCK),
|
||||
MELLOW( "MELLOWARPEGGIATION", "Mellow", "Industrial lighting, animation tools", "Make something cool now, ask for permission later.", true, ScrapType.CPU_LOGIC);
|
||||
|
||||
public String name; //the title of the tooltip
|
||||
public String label; //the name engraved in the socket
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.lang.Math;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.generic.BlockBobble.BobbleType;
|
||||
import com.hbm.blocks.generic.BlockBobble.TileEntityBobble;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@ -59,6 +65,8 @@ public class GUIScreenBobble extends GuiScreen {
|
||||
nextLevel += 10;
|
||||
|
||||
String bobbleName = this.bobble.type.name;
|
||||
if(this.bobble.type == BobbleType.MELLOW)
|
||||
bobbleName = anagramIt(bobbleName, "GEORGEWILLIAMPATON");
|
||||
this.fontRendererObj.drawStringWithShadow(bobbleName, (int)(left + sizeX / 2 - this.fontRendererObj.getStringWidth(bobbleName) / 2), nextLevel, 0x009900);
|
||||
|
||||
nextLevel += 20;
|
||||
@ -110,4 +118,49 @@ public class GUIScreenBobble extends GuiScreen {
|
||||
public boolean doesGuiPauseGame() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Animates the letters (from -> to) back and forth over 1.5 seconds
|
||||
private String anagramIt(String from, String to) {
|
||||
double t = Math.sin((double)System.currentTimeMillis() / 1500.0) * 0.75 + 0.5;
|
||||
|
||||
char[] lettersFrom = from.toCharArray();
|
||||
char[] lettersTo = to.toCharArray();
|
||||
boolean[] hasPairedLetter = new boolean[lettersFrom.length];
|
||||
List<Pair<Double, Character>> letterTargets = new ArrayList<Pair<Double, Character>>();
|
||||
|
||||
for(int i = 0; i < lettersFrom.length; i++) {
|
||||
char letterFrom = lettersFrom[i];
|
||||
for(int o = 0; o < lettersTo.length; o++) {
|
||||
char letterTo = lettersTo[o];
|
||||
if(letterFrom == letterTo && !hasPairedLetter[o]) {
|
||||
double v = lerp((double)i, (double)o, t);
|
||||
letterTargets.add(new Pair<Double,Character>(v, lettersFrom[i]));
|
||||
hasPairedLetter[o] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < letterTargets.size(); i++) {
|
||||
for (int j = i + 1; j < letterTargets.size(); j++) {
|
||||
if (letterTargets.get(i).key > letterTargets.get(j).key) {
|
||||
Pair<Double, Character> temp = letterTargets.get(i);
|
||||
letterTargets.set(i, letterTargets.get(j));
|
||||
letterTargets.set(j, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String anagrammedText = "";
|
||||
for(Pair<Double, Character> in : letterTargets) {
|
||||
anagrammedText += in.value;
|
||||
}
|
||||
|
||||
return anagrammedText;
|
||||
}
|
||||
|
||||
private double lerp(double a, double b, double t) {
|
||||
t = Math.max(Math.min(t, 1), 0);
|
||||
return a * (1 - t) + b * t;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ public class RenderBobble extends TileEntitySpecialRenderer {
|
||||
|
||||
public static final IModelCustom bobble = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/trinkets/bobble.obj"));
|
||||
public static final ResourceLocation socket = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/socket.png");
|
||||
public static final ResourceLocation glow = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/glow.png");
|
||||
public static final ResourceLocation lamp = new ResourceLocation(RefStrings.MODID, "textures/blocks/fluorescent_lamp.png");
|
||||
|
||||
public static final ResourceLocation bobble_vaultboy = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/vaultboy.png");
|
||||
public static final ResourceLocation bobble_hbm = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/hbm.png");
|
||||
@ -47,6 +49,7 @@ public class RenderBobble extends TileEntitySpecialRenderer {
|
||||
public static final ResourceLocation bobble_cirno = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/cirno.png");
|
||||
public static final ResourceLocation bobble_microwave = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/microwave.png");
|
||||
public static final ResourceLocation bobble_peep = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/peep.png");
|
||||
public static final ResourceLocation bobble_mellow = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/mellowrpg8.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float intero) {
|
||||
@ -98,6 +101,7 @@ public class RenderBobble extends TileEntitySpecialRenderer {
|
||||
case DRILLGON: bindTexture(bobble_drillgon); break;
|
||||
case MICROWAVE: bindTexture(bobble_microwave); break;
|
||||
case PEEP: bindTexture(bobble_peep); break;
|
||||
case MELLOW: bindTexture(bobble_mellow); break;
|
||||
default: bindTexture(ResourceManager.universal);
|
||||
}
|
||||
|
||||
@ -201,10 +205,17 @@ public class RenderBobble extends TileEntitySpecialRenderer {
|
||||
case VAER:
|
||||
rotLeftArm = new double[]{0, -5, 45};
|
||||
rotRightArm = new double[]{0, 15, 45};
|
||||
break;
|
||||
case PEEP:
|
||||
rotLeftArm = new double[]{0, 0, 1};
|
||||
rotRightArm = new double[]{0, 0, 1};
|
||||
break;
|
||||
case MELLOW:
|
||||
rotLeftArm = new double[]{0, 10, 0};
|
||||
rotRightArm = new double[]{0, -10, 0};
|
||||
rotLeftLeg = new double[]{3, 5, 2};
|
||||
rotRightLeg = new double[]{-3, -5, 0};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,6 +453,20 @@ public class RenderBobble extends TileEntitySpecialRenderer {
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
shotgun.renderDud(0.0625F);
|
||||
break;
|
||||
case MELLOW:
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
|
||||
this.bindTexture(lamp);
|
||||
bobble.renderPart("Fluoro");
|
||||
this.bindTexture(glow);
|
||||
bobble.renderPart("Glow");
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopAttrib();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
BIN
src/main/resources/assets/hbm/textures/models/trinkets/glow.png
Normal file
BIN
src/main/resources/assets/hbm/textures/models/trinkets/glow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
Loading…
x
Reference in New Issue
Block a user