mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 10:47:30 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
7ea58409dc
11 files changed
+262
-85
No files matched your search
@@ -35,7 +35,7 @@ import noppes.npcs.scripted.NpcAPI;
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.9-beta1")
|
||||
@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.9-beta2")
|
||||
public class CustomNpcs {
|
||||
|
||||
@SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy")
|
||||
|
||||
@@ -879,6 +879,9 @@ public class PacketHandlerServer{
|
||||
else if(type == EnumPacketServer.JobSpawnerRemove){
|
||||
if(npc.advanced.job != EnumJobType.Spawner)
|
||||
return;
|
||||
JobSpawner job = (JobSpawner) npc.jobInterface;
|
||||
job.setJobCompound(buffer.readInt(), null);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, job.getTitles());
|
||||
}
|
||||
else if(type == EnumPacketServer.RoleSave){
|
||||
npc.roleInterface.readFromNBT(Server.readNBT(buffer));
|
||||
|
||||
@@ -544,7 +544,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
public FontContainer(String fontType, int fontSize) {
|
||||
textFont = new StringCache();
|
||||
textFont.setDefaultFont("Arial", fontSize, true);
|
||||
textFont.setDefaultFont("Arial Unicode MS", fontSize, true);
|
||||
useCustomFont = !fontType.equalsIgnoreCase("minecraft");
|
||||
try {
|
||||
if(!useCustomFont || fontType.isEmpty() || fontType.equalsIgnoreCase("default"))
|
||||
@@ -552,7 +552,7 @@ public class ClientProxy extends CommonProxy {
|
||||
else
|
||||
textFont.setDefaultFont(fontType, fontSize, true);
|
||||
} catch (Exception e) {
|
||||
LogWriter.info("Failed loading font so using Arial");
|
||||
LogWriter.info("Failed loading font so using Arial Unicode MS");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
addButton(new GuiNpcButton(10, guiLeft + 70, y += 22, 50, 20, new String[]{"gui.text", "gui.option", "display.fixed"}, dialog.titlePos));
|
||||
addLabel(new GuiNpcLabel(10, "dialog.titlePos", guiLeft + 4, y + 5));
|
||||
|
||||
addButton(new GuiNpcButton(24, guiLeft + 192, y, 50, 20, new String[]{"display.top", "display.bottom"}, dialog.alignment));
|
||||
addButton(new GuiNpcButton(24, guiLeft + 192, y, 50, 20, new String[]{"display.bottom", "display.top"}, dialog.alignment));
|
||||
addLabel(new GuiNpcLabel(27, "display.alignment", guiLeft + 126, y + 5));
|
||||
|
||||
addTextField(new GuiNpcTextField(11, this, guiLeft + 120, y += 25, 40, 20, String.valueOf(dialog.textWidth)));
|
||||
|
||||
@@ -503,7 +503,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
int height = count - totalRows + lineOffset;
|
||||
int screenPos = optionStart;
|
||||
int y = (height * ClientProxy.Font.height()) + screenPos + scrollY;
|
||||
if (dialog.alignment == 0) {
|
||||
if (dialog.alignment == 1) {
|
||||
height = count - totalRows + lineOffset + 1;
|
||||
screenPos = optionStart - dialog.textHeight + ClientProxy.Font.height() + (totalRows - lineOffset);
|
||||
|
||||
@@ -515,7 +515,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
}
|
||||
|
||||
if (block.titlePos == 0 || mainDialogText) {
|
||||
if (dialog.alignment == 0) {
|
||||
if (dialog.alignment == 1) {
|
||||
if (y < optionStart - dialog.textHeight || y > optionStart - ClientProxy.Font.height()/2f) {
|
||||
return;
|
||||
}
|
||||
@@ -584,7 +584,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
textSoundEnabled = !textSoundEnabled;
|
||||
}
|
||||
|
||||
if (dialog.alignment == 0 && totalRows * ClientProxy.Font.height() > dialog.textHeight) {
|
||||
if (dialog.alignment == 1 && totalRows * ClientProxy.Font.height() > dialog.textHeight) {
|
||||
if ((i == mc.gameSettings.keyBindBack.getKeyCode() || i == 201) && scrollY < totalRows * ClientProxy.Font.height()) {//Page up
|
||||
scrollY += ClientProxy.Font.height() * 2;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ public class GuiNpcSpawner extends GuiNPCInterface2 implements ITextfieldListene
|
||||
public String title4 = "gui.selectnpc";
|
||||
public String title5 = "gui.selectnpc";
|
||||
public String title6 = "gui.selectnpc";
|
||||
public String title7 = "gui.selectnpc";
|
||||
public String title8 = "gui.selectnpc";
|
||||
|
||||
public GuiNpcSpawner(EntityNPCInterface npc)
|
||||
{
|
||||
@@ -36,59 +38,83 @@ public class GuiNpcSpawner extends GuiNPCInterface2 implements ITextfieldListene
|
||||
|
||||
int y = guiTop + 6;
|
||||
|
||||
this.addButton(new GuiNpcButton(20, guiLeft + 25, y,20,20, "X"));
|
||||
this.addButton(new GuiNpcButton(20, guiLeft + 20, y,20,20, "X"));
|
||||
addLabel(new GuiNpcLabel(0, "1:", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 50, y, title1));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 45, y, 140, 20, title1));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 25, y,20,20, "X"));
|
||||
addLabel(new GuiNpcLabel(6, "spawner.diesafter", guiLeft + 4 + 190, y + 5));
|
||||
this.addButton(new GuiNpcButton(26, guiLeft + 370, y,40,20, new String[]{"gui.yes","gui.no"}, job.doesntDie?1:0));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 20, y,20,20, "X"));
|
||||
addLabel(new GuiNpcLabel(1, "2:", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 50, y, title2));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 45, y, 140, 20, title2));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(22, guiLeft + 25, y,20,20, "X"));
|
||||
addLabel(new GuiNpcLabel(11, "spawner.despawn", guiLeft + 4 + 190, y + 5));
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 370, y,40,20, new String[]{"gui.no","gui.yes"}, job.despawnOnTargetLost?1:0));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(22, guiLeft + 20, y,20,20, "X"));
|
||||
addLabel(new GuiNpcLabel(2, "3:", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 50, y, title3));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 45, y, 140, 20, title3));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 25, y,20,20, "X"));
|
||||
addLabel(new GuiNpcLabel(27, "spawner.despawnsummon", guiLeft + 4 + 190, y + 5));
|
||||
this.addButton(new GuiNpcButton(27, guiLeft + 370, y,40,20, new String[]{"gui.no","gui.yes"}, job.despawnOnSummonerDeath ?0:1));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 20, y,20,20, "X"));
|
||||
addLabel(new GuiNpcLabel(3, "4:", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 50, y, title4));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 45, y, 140, 20, title4));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(24, guiLeft + 25, y,20,20, "X"));
|
||||
this.addButton(new GuiNpcButton(24, guiLeft + 20, y,20,20, "X"));
|
||||
addLabel(new GuiNpcLabel(4, "5:", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 50, y, title5));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 45, y, 140, 20, title5));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(25, guiLeft + 25, y,20,20, "X"));
|
||||
this.addButton(new GuiNpcButton(25, guiLeft + 20, y,20,20, "X"));
|
||||
addLabel(new GuiNpcLabel(5, "6:", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 50, y, title6));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 45, y, 140, 20, title6));
|
||||
|
||||
y += 23;
|
||||
addLabel(new GuiNpcLabel(6, "spawner.diesafter", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(26, guiLeft + 115, y,40,20, new String[]{"gui.yes","gui.no"}, job.doesntDie?1:0));
|
||||
y += 23;
|
||||
y += 23;
|
||||
|
||||
addLabel(new GuiNpcLabel(11, "spawner.despawn", guiLeft + 170, y + 5));
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 335, y,40,20, new String[]{"gui.no","gui.yes"}, job.despawnOnTargetLost?1:0));
|
||||
|
||||
y += 23;
|
||||
addLabel(new GuiNpcLabel(7,StatCollector.translateToLocal("spawner.posoffset")+" X:", guiLeft + 4, y + 5));
|
||||
addTextField(new GuiNpcTextField(7,this, fontRendererObj, guiLeft + 99, y, 24, 20, job.xOffset + ""));
|
||||
addLabel(new GuiNpcLabel(7,StatCollector.translateToLocal("spawner.posoffset")+" X:", guiLeft + 4 + 190, y + 5));
|
||||
addTextField(new GuiNpcTextField(7,this, fontRendererObj, guiLeft + 99 + 190, y, 24, 20, job.xOffset + ""));
|
||||
getTextField(7).integersOnly = true;
|
||||
getTextField(7).setMinMaxDefault(-9, 9, 0);
|
||||
addLabel(new GuiNpcLabel(8,"Y:", guiLeft + 125, y + 5));
|
||||
addTextField(new GuiNpcTextField(8,this, fontRendererObj, guiLeft + 135, y, 24, 20, job.yOffset + ""));
|
||||
addLabel(new GuiNpcLabel(8,"Y:", guiLeft + 125 + 190, y + 5));
|
||||
addTextField(new GuiNpcTextField(8,this, fontRendererObj, guiLeft + 135 + 190, y, 24, 20, job.yOffset + ""));
|
||||
getTextField(8).integersOnly = true;
|
||||
getTextField(8).setMinMaxDefault(-9, 9, 0);
|
||||
addLabel(new GuiNpcLabel(9,"Z:", guiLeft + 161, y + 5));
|
||||
addTextField(new GuiNpcTextField(9,this, fontRendererObj, guiLeft + 171, y, 24, 20, job.zOffset + ""));
|
||||
addLabel(new GuiNpcLabel(9,"Z:", guiLeft + 161 + 190, y + 5));
|
||||
addTextField(new GuiNpcTextField(9,this, fontRendererObj, guiLeft + 171 + 190, y, 24, 20, job.zOffset + ""));
|
||||
getTextField(9).integersOnly = true;
|
||||
getTextField(9).setMinMaxDefault(-9, 9, 0);
|
||||
|
||||
y += 23;
|
||||
addLabel(new GuiNpcLabel(10, "spawner.type", guiLeft + 4, y + 5));
|
||||
addButton(new GuiNpcButton(10, guiLeft + 80, y, 100, 20, new String[]{"spawner.one", "spawner.all", "spawner.random"}, job.spawnType));
|
||||
addLabel(new GuiNpcLabel(10, "spawner.type", guiLeft + 4 + 190, y + 5));
|
||||
addButton(new GuiNpcButton(10, guiLeft + 80 + 190, y, 100, 20, new String[]{"spawner.one", "spawner.all", "spawner.random", "spawner.summoner"}, job.spawnType));
|
||||
|
||||
if(job.despawnOnSummonerDeath){
|
||||
job.doesntDie = true;
|
||||
getButton(26).setEnabled(false);
|
||||
getButton(26).setDisplay(1);
|
||||
}
|
||||
|
||||
if(job.spawnType == 3){
|
||||
job.doesntDie = true;
|
||||
getButton(26).setEnabled(false);
|
||||
getButton(26).setDisplay(1);
|
||||
|
||||
job.despawnOnTargetLost = false;
|
||||
getButton(11).setEnabled(false);
|
||||
getButton(11).setDisplay(0);
|
||||
|
||||
job.despawnOnSummonerDeath = false;
|
||||
getButton(27).setEnabled(false);
|
||||
getButton(27).setDisplay(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,14 +128,48 @@ public class GuiNpcSpawner extends GuiNPCInterface2 implements ITextfieldListene
|
||||
setSubGui(new GuiNpcMobSpawnerSelector());
|
||||
}
|
||||
if(button.id >= 20 && button.id < 26){
|
||||
job.setJobCompound(button.id - 19, null);
|
||||
int removeID = button.id - 19;
|
||||
job.setJobCompound(removeID, null);
|
||||
Client.sendData(EnumPacketServer.JobSpawnerRemove, button.id - 19);
|
||||
}
|
||||
if(button.id == 26){
|
||||
job.doesntDie = button.getValue() == 1;
|
||||
}
|
||||
if(button.id == 27){
|
||||
job.despawnOnSummonerDeath = button.getValue() == 1;
|
||||
if(job.despawnOnSummonerDeath){
|
||||
job.doesntDie = true;
|
||||
getButton(26).setEnabled(false);
|
||||
getButton(26).setDisplay(1);
|
||||
}
|
||||
else {
|
||||
if(job.spawnType != 3){
|
||||
getButton(26).setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(button.id == 10){
|
||||
job.spawnType = button.getValue();
|
||||
if(job.spawnType == 3){
|
||||
job.doesntDie = true;
|
||||
getButton(26).setEnabled(false);
|
||||
getButton(26).setDisplay(1);
|
||||
|
||||
job.despawnOnTargetLost = false;
|
||||
getButton(11).setEnabled(false);
|
||||
getButton(11).setDisplay(0);
|
||||
|
||||
job.despawnOnSummonerDeath = false;
|
||||
getButton(27).setEnabled(false);
|
||||
getButton(27).setDisplay(0);
|
||||
}
|
||||
else {
|
||||
if(!job.despawnOnSummonerDeath){
|
||||
getButton(26).setEnabled(true);
|
||||
}
|
||||
getButton(11).setEnabled(true);
|
||||
getButton(27).setEnabled(true);
|
||||
}
|
||||
}
|
||||
if(button.id == 11){
|
||||
job.despawnOnTargetLost = button.getValue() == 1;
|
||||
@@ -152,6 +212,7 @@ public class GuiNpcSpawner extends GuiNPCInterface2 implements ITextfieldListene
|
||||
if(textfield.id == 9){
|
||||
job.zOffset = textfield.getInteger();
|
||||
}
|
||||
save();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,9 +11,12 @@ import net.minecraft.util.ChatAllowedCharacters;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.gui.util.TextContainer.LineData;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import sun.font.TrueTypeFont;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -42,11 +45,11 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
private int cursorPosition;
|
||||
private int scrolledLine = 0;
|
||||
private boolean enableCodeHighlighting = false;
|
||||
private static final char colorChar = '\uffff';
|
||||
public List<GuiScriptTextArea.UndoData> undoList = new ArrayList();
|
||||
public List<GuiScriptTextArea.UndoData> redoList = new ArrayList();
|
||||
public boolean undoing = false;
|
||||
private long lastClicked = 0L;
|
||||
// private static TrueTypeFont font = new TrueTypeFont(new Font("Arial Unicode MS", Font.PLAIN, ConfigClient.FontSize), 1);
|
||||
|
||||
public GuiScriptTextArea(GuiScreen guiScreen, int id, int x, int y, int width, int height, String text) {
|
||||
super(id, guiScreen, x, y, width, height, null);
|
||||
@@ -309,6 +312,47 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
endSelection = cursorPosition = startSelection;
|
||||
return true;
|
||||
}
|
||||
if(isKeyComboCtrlBackspace(i)){
|
||||
String s = getSelectionBeforeText();
|
||||
if(startSelection > 0 && startSelection == endSelection){
|
||||
int nearestCondition = cursorPosition;
|
||||
int g;
|
||||
boolean cursorInWhitespace = Character.isWhitespace(s.charAt(cursorPosition - 1));
|
||||
if(cursorInWhitespace){
|
||||
// Find the nearest word if we are starting in whitespace
|
||||
for (g = cursorPosition - 1; g >= 0; g--) {
|
||||
char currentChar = s.charAt(g);
|
||||
if (!Character.isWhitespace(currentChar)) {
|
||||
nearestCondition = g;
|
||||
break;
|
||||
}
|
||||
if(g == 0){
|
||||
nearestCondition = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Find the nearest blank space or new line
|
||||
for (g = cursorPosition - 1; g >= 0; g--) {
|
||||
char currentChar = s.charAt(g);
|
||||
if (Character.isWhitespace(currentChar) || currentChar == '\n') {
|
||||
nearestCondition = g;
|
||||
break;
|
||||
}
|
||||
if(g == 0){
|
||||
nearestCondition = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all text to the left up to the nearest boundary
|
||||
s = s.substring(0, nearestCondition);
|
||||
startSelection -= (cursorPosition - nearestCondition);
|
||||
}
|
||||
setText(s + getSelectionAfterText());
|
||||
endSelection = cursorPosition = startSelection;
|
||||
return true;
|
||||
}
|
||||
if(i == Keyboard.KEY_BACK){
|
||||
String s = getSelectionBeforeText();
|
||||
if(startSelection > 0 && startSelection == endSelection){
|
||||
@@ -389,6 +433,11 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
return keyID == 45 && isCtrlKeyDown() && !isShiftKeyDown() && !isAltKeyDown();
|
||||
}
|
||||
|
||||
private boolean isKeyComboCtrlBackspace(int keyID)
|
||||
{
|
||||
return keyID == Keyboard.KEY_BACK && isCtrlKeyDown() && !isShiftKeyDown() && !isAltKeyDown();
|
||||
}
|
||||
|
||||
private boolean isKeyComboCtrlV(int keyID)
|
||||
{
|
||||
return keyID == 47 && isCtrlKeyDown() && !isShiftKeyDown() && !isAltKeyDown();
|
||||
|
||||
@@ -3,10 +3,14 @@ package noppes.npcs.client.renderer.blocks;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.blocks.BlockWallBanner;
|
||||
import noppes.npcs.blocks.tiles.TileWallBanner;
|
||||
@@ -54,23 +58,67 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
|
||||
}
|
||||
public void doRender(double par2, double par4, double par6, int meta, ItemStack iicon)
|
||||
{
|
||||
if (iicon.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(iicon.getItem()).getRenderType()))
|
||||
return;
|
||||
GL11.glPushMatrix();
|
||||
bindTexture(TextureMap.locationItemsTexture);
|
||||
GL11.glTranslatef((float)par2 + 0.5f, (float)par4 +0.2f, (float)par6 + 0.5f);
|
||||
GL11.glTranslatef((float)par2 + 0.5f, (float)par4 +1.3f, (float)par6 + 0.5f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(90 * meta, 0, 1, 0);
|
||||
GL11.glTranslatef(0, 0, 0.26f);
|
||||
GL11.glRotatef(90 * meta, 0, 1, 0);
|
||||
GL11.glTranslatef(0, 0, -0.14f);
|
||||
GL11.glDepthMask(false);
|
||||
float f2 = 0.05f;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GL11.glScalef(f2, f2, f2);
|
||||
renderer.renderItemIntoGUI(this.func_147498_b(), mc.renderEngine, iicon, -8, -8);
|
||||
renderItemBanner(mc.renderEngine, iicon, -8, -8, false);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
public void renderItemBanner(TextureManager txtMng, ItemStack item, int p_77015_4_, int p_77015_5_, boolean renderEffect)
|
||||
{
|
||||
Object object = item.getIconIndex();
|
||||
int l;
|
||||
float f;
|
||||
float f3;
|
||||
float f4;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
ResourceLocation resourcelocation = txtMng.getResourceLocation(item.getItemSpriteNumber());
|
||||
txtMng.bindTexture(resourcelocation);
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
object = ((TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("missingno");
|
||||
}
|
||||
|
||||
l = item.getItem().getColorFromItemStack(item, 0);
|
||||
f3 = (float)(l >> 16 & 255) / 255.0F;
|
||||
f4 = (float)(l >> 8 & 255) / 255.0F;
|
||||
f = (float)(l & 255) / 255.0F;
|
||||
|
||||
if (renderer.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f3, f4, f, 1.0F);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, a renderEffect can derp them up.
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
renderer.renderIcon(p_77015_4_, p_77015_5_, (IIcon)object, 16, 16);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
if (renderEffect && item.hasEffect(0))
|
||||
{
|
||||
renderer.renderEffect(txtMng, p_77015_4_, p_77015_5_);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Dialog implements ICompatibilty, IDialog {
|
||||
public boolean darkenScreen = true;
|
||||
public boolean showOptionLine = true;
|
||||
|
||||
//0 - Top, 1 - Bottom, 2 (Not implemented yet) - Center
|
||||
//0 - Bottom, 1 - Top, 2 - Center [Unimplemented]
|
||||
public byte alignment = 0;
|
||||
|
||||
public boolean renderGradual = false;
|
||||
@@ -186,7 +186,8 @@ public class Dialog implements ICompatibilty, IDialog {
|
||||
compound.setBoolean("DialogDisableEsc", disableEsc);
|
||||
|
||||
compound.setBoolean("DialogDarkScreen", darkenScreen);
|
||||
|
||||
compound.setByte("DialogAlignment", alignment);
|
||||
|
||||
if(sound != null && !sound.isEmpty())
|
||||
compound.setString("DialogSound", sound);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.compat.PixelmonHelper;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
@@ -22,13 +23,6 @@ public class JobSpawner extends JobInterface{
|
||||
public NBTTagCompound compound3;
|
||||
public NBTTagCompound compound2;
|
||||
public NBTTagCompound compound1;
|
||||
|
||||
public String title1;
|
||||
public String title2;
|
||||
public String title3;
|
||||
public String title4;
|
||||
public String title5;
|
||||
public String title6;
|
||||
|
||||
private int number = 0;
|
||||
|
||||
@@ -37,8 +31,12 @@ public class JobSpawner extends JobInterface{
|
||||
private Map<String,Long> cooldown = new HashMap<String,Long>();
|
||||
|
||||
private String id = RandomStringUtils.random(8, true, true);
|
||||
|
||||
public boolean doesntDie = false;
|
||||
|
||||
public boolean despawnOnSummonerDeath = false;
|
||||
public boolean despawnOnTargetLost = true;
|
||||
|
||||
// 0 - One By One, 1 - All at Once, 2 - Random, 3 - When Summoner Dies
|
||||
public int spawnType = 0;
|
||||
|
||||
public int xOffset = 0;
|
||||
@@ -47,7 +45,6 @@ public class JobSpawner extends JobInterface{
|
||||
|
||||
private EntityLivingBase target;
|
||||
|
||||
public boolean despawnOnTargetLost = true;
|
||||
|
||||
public JobSpawner(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
@@ -70,6 +67,7 @@ public class JobSpawner extends JobInterface{
|
||||
compound.setInteger("SpawnerZOffset", zOffset);
|
||||
|
||||
compound.setBoolean("DespawnOnTargetLost", despawnOnTargetLost);
|
||||
compound.setBoolean("DespawnOnSummmoner", despawnOnSummonerDeath);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@@ -114,6 +112,7 @@ public class JobSpawner extends JobInterface{
|
||||
zOffset = compound.getInteger("SpawnerZOffset");
|
||||
|
||||
despawnOnTargetLost = compound.getBoolean("DespawnOnTargetLost");
|
||||
despawnOnSummonerDeath = compound.getBoolean("DespawnOnSummmoner");
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +216,7 @@ public class JobSpawner extends JobInterface{
|
||||
|
||||
public boolean shouldDelete(EntityLivingBase entity){
|
||||
return npc.getDistanceToEntity(entity) > 60 || entity.isDead || entity.getHealth() <= 0 ||
|
||||
PixelmonHelper.Enabled && hasPixelmon() && !PixelmonHelper.isBattling(entity) || despawnOnTargetLost && target == null;
|
||||
PixelmonHelper.Enabled && hasPixelmon() && !PixelmonHelper.isBattling(entity) || (despawnOnSummonerDeath && npc.isDead) || despawnOnTargetLost && target == null;
|
||||
}
|
||||
|
||||
private EntityLivingBase getTarget() {
|
||||
@@ -287,7 +286,7 @@ public class JobSpawner extends JobInterface{
|
||||
public boolean aiShouldExecute() {
|
||||
if(isEmpty() || npc.isKilled())
|
||||
return false;
|
||||
|
||||
|
||||
target = getTarget();
|
||||
if(npc.getRNG().nextInt(30) == 1){
|
||||
if(spawned.isEmpty())
|
||||
@@ -326,6 +325,15 @@ public class JobSpawner extends JobInterface{
|
||||
}
|
||||
@Override
|
||||
public void killed() {
|
||||
if(spawnType == 3){
|
||||
spawnEntity(compound1);
|
||||
spawnEntity(compound2);
|
||||
spawnEntity(compound3);
|
||||
spawnEntity(compound4);
|
||||
spawnEntity(compound5);
|
||||
spawnEntity(compound6);
|
||||
number = 6;
|
||||
}
|
||||
reset();
|
||||
}
|
||||
|
||||
@@ -343,36 +351,43 @@ public class JobSpawner extends JobInterface{
|
||||
double x = this.npc.posX + xOffset - 0.5 + this.npc.getRNG().nextFloat();
|
||||
double y = this.npc.posY + yOffset;
|
||||
double z = this.npc.posZ + zOffset - 0.5 + this.npc.getRNG().nextFloat();
|
||||
|
||||
World world = this.npc.getEntityWorld();
|
||||
Entity entity = EntityList.createEntityFromNBT(compound, world);
|
||||
if(!(entity instanceof EntityLivingBase))
|
||||
Entity entity = NoppesUtilServer.getEntityFromNBT(compound, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), npc.worldObj);
|
||||
if(entity == null){
|
||||
return null;
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
living.getEntityData().setString("NpcSpawnerId", id);
|
||||
living.getEntityData().setInteger("NpcSpawnerNr", number);
|
||||
setTarget(living, this.npc.getAttackTarget());
|
||||
entity.setPosition(x + 0.5, y + 1 + 0.2F, z + 0.5);
|
||||
|
||||
if(living instanceof EntityNPCInterface){
|
||||
EntityNPCInterface snpc = (EntityNPCInterface) living;
|
||||
snpc.ai.startPos = new int[]{(int) x, (int) snpc.getStartYPos(), (int) z};
|
||||
snpc.stats.spawnCycle = 3;
|
||||
snpc.ai.returnToStart = false;
|
||||
snpc.setPosition((float)x + 0.5F, snpc.getStartYPos(), (float)z + 0.5F);
|
||||
snpc.reset();
|
||||
}
|
||||
entity.dimension = npc.worldObj.provider.dimensionId;
|
||||
if (!entity.forceSpawn && !npc.worldObj.checkChunksExist(
|
||||
(int)entity.posX,(int)entity.posY,(int)entity.posZ,(int)entity.posX,(int)entity.posY,(int)entity.posZ
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
if (!(entity instanceof EntityLivingBase))
|
||||
return null;
|
||||
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
living.getEntityData().setString("NpcSpawnerId", id);
|
||||
living.getEntityData().setInteger("NpcSpawnerNr", number);
|
||||
setTarget(living, this.npc.getAttackTarget());
|
||||
living.setPosition(x + 0.5, y + 1 + 0.2F, z + 0.5);
|
||||
|
||||
int i = MathHelper.floor_double(entity.posX / 16.0D);
|
||||
int j = MathHelper.floor_double(entity.posZ / 16.0D);
|
||||
entity.dimension = world.provider.dimensionId;
|
||||
world.getChunkFromChunkCoords(i, j).addEntity(entity);
|
||||
world.loadedEntityList.add(entity);
|
||||
world.onEntityAdded(entity);
|
||||
if (living instanceof EntityNPCInterface) {
|
||||
EntityNPCInterface snpc = (EntityNPCInterface) living;
|
||||
snpc.stats.spawnCycle = 3;
|
||||
snpc.ai.returnToStart = false;
|
||||
snpc.stats.canDespawn = true;
|
||||
snpc.stats.playerSetCanDespawn = true;
|
||||
}
|
||||
|
||||
spawned.add(living);
|
||||
return living;
|
||||
int i = MathHelper.floor_double(living.posX / 16.0D);
|
||||
int j = MathHelper.floor_double(living.posZ / 16.0D);
|
||||
|
||||
npc.worldObj.getChunkFromChunkCoords(i, j).addEntity(living);
|
||||
npc.worldObj.loadedEntityList.add(living);
|
||||
npc.worldObj.onEntityAdded(living);
|
||||
spawned.add(living);
|
||||
return living;
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound getCompound(int i) {
|
||||
|
||||
Reference in new issue
Block a user