Merge remote-tracking branch 'origin/dev' into animation-events

# Conflicts:
#	src/api
#	src/main/java/noppes/npcs/controllers/data/AnimationData.java
This commit is contained in:
luisc committed 2024-04-01 16:32:45 -05:00
commit d055d434df
377 files changed
+2385 -1098

No files matched your search

@@ -5,10 +5,12 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderLivingEvent;
@@ -32,6 +34,10 @@ public class ClientEventHandler {
public static HashMap<Integer,Long> disabledButtonTimes = new HashMap<>();
public static float partialHandTicks;
public static boolean firstPersonAnimation;
public static ModelBiped firstPersonModel;
public static final ResourceLocation steveTextures = new ResourceLocation("textures/entity/steve.png");
public static final ResourceLocation fem = new ResourceLocation("jinryuufamilyc:fem.png");
public static float partialRenderTick;
public static RendererLivingEntity renderer;
@@ -6,6 +6,8 @@ import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
@@ -30,6 +32,7 @@ import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.ScriptParticle;
import org.lwjgl.Sys;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.net.URI;
@@ -326,4 +329,38 @@ public class NoppesUtil {
public static void isGUIOpen(boolean isGUIOpen) {
Client.sendData(EnumPacketServer.IsGuiOpen, isGUIOpen);
}
private static byte[] accumulatedData = new byte[0];
public static void handleLargeData(byte[] chunk) {
// Append the chunk to the accumulated data
accumulatedData = concatByteArrays(accumulatedData, chunk);
}
public static void handlePlayerDataEnd(boolean sync) {
NBTTagCompound compound;
try {
compound = CompressedStreamTools.func_152457_a(accumulatedData, new NBTSizeTracker(2097152L));
if(sync){
ClientCacheHandler.playerData.setSyncNBT(compound);
}
else {
ClientCacheHandler.playerData.setSyncNBTFull(compound);
}
} catch (IOException e) {
e.printStackTrace();
return;
} finally {
// Reset the accumulated data after processing
accumulatedData = new byte[0];
}
}
// Utility method to concatenate two byte arrays
private static byte[] concatByteArrays(byte[] a, byte[] b) {
byte[] result = new byte[a.length + b.length];
System.arraycopy(a, 0, result, 0, a.length);
System.arraycopy(b, 0, result, a.length, b.length);
return result;
}
}
@@ -112,15 +112,20 @@ public class PacketHandlerClient extends PacketHandlerServer{
RecipeController.Instance.anvilRecipes = RecipeController.syncRecipes;
RecipeController.syncRecipes = new HashMap<Integer, RecipeCarpentry>();
}
else if(type == EnumPacketClient.LARGE_NBT_PART){
byte[] chunk = new byte[buffer.readShort()];
buffer.readBytes(chunk);
NoppesUtil.handleLargeData(chunk);
}
else if(type == EnumPacketClient.SYNC_PLAYER){
boolean sync = buffer.readBoolean();
NoppesUtil.handlePlayerDataEnd(sync);
}
else if(type == EnumPacketClient.SYNC_ADD || type == EnumPacketClient.SYNC_END){
int synctype = buffer.readInt();
NBTTagCompound compound = Server.readNBT(buffer);
SyncController.clientSync(synctype, compound, type == EnumPacketClient.SYNC_END);
if(synctype == SyncType.PLAYER_DATA){
ClientCacheHandler.playerData.setNBT(compound);
}
}
else if(type == EnumPacketClient.SYNC_UPDATE){
int synctype = buffer.readInt();
@@ -360,6 +365,7 @@ public class PacketHandlerClient extends PacketHandlerServer{
ClientCacheHandler.playerAnimations.put(sendingPlayer.getUniqueID(), new AnimationData(sendingPlayer));
}
animationData = ClientCacheHandler.playerAnimations.get(sendingPlayer.getUniqueID());
animationData.parent = sendingPlayer;
}
}
@@ -29,25 +29,25 @@ public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSe
getLabel(1).center(xSize);
int y = guiTop + 12;
this.addButton(new GuiNpcButton(0, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive"},availabitily.questAvailable.ordinal()));
this.addButton(new GuiNpcButton(0, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"},availabitily.questAvailable.ordinal()));
this.addButton(new GuiNpcButton(10, guiLeft + 96, y, 192, 20, "availability.selectquest"));
getButton(10).setEnabled(availabitily.questAvailable != EnumAvailabilityQuest.Always);
this.addButton(new GuiNpcButton(20, guiLeft + 290, y, 20, 20, "X"));
y += 23;
this.addButton(new GuiNpcButton(1, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive"},availabitily.quest2Available.ordinal()));
this.addButton(new GuiNpcButton(1, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"},availabitily.quest2Available.ordinal()));
this.addButton(new GuiNpcButton(11, guiLeft + 96, y, 192, 20, "availability.selectquest"));
getButton(11).setEnabled(availabitily.quest2Available != EnumAvailabilityQuest.Always);
this.addButton(new GuiNpcButton(21, guiLeft + 290, y, 20, 20, "X"));
y += 23;
this.addButton(new GuiNpcButton(2, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive"},availabitily.quest3Available.ordinal()));
this.addButton(new GuiNpcButton(2, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"},availabitily.quest3Available.ordinal()));
this.addButton(new GuiNpcButton(12, guiLeft + 96, y, 192, 20, "availability.selectquest"));
getButton(12).setEnabled(availabitily.quest3Available != EnumAvailabilityQuest.Always);
this.addButton(new GuiNpcButton(22, guiLeft + 290, y, 20, 20, "X"));
y += 23;
this.addButton(new GuiNpcButton(3, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive"},availabitily.quest4Available.ordinal()));
this.addButton(new GuiNpcButton(3, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"},availabitily.quest4Available.ordinal()));
this.addButton(new GuiNpcButton(13, guiLeft + 96, y, 192, 20, "availability.selectquest"));
getButton(13).setEnabled(availabitily.quest4Available != EnumAvailabilityQuest.Always);
this.addButton(new GuiNpcButton(23, guiLeft + 290, y, 20, 20, "X"));
@@ -333,10 +333,12 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
DialogImage selectedImage = (DialogImage) dialog.dialogImages.get(Integer.valueOf(imageScroll.getSelected()));
ArrayList<Integer> keys = new ArrayList<>(dialog.dialogImages.keySet());
int keyIndex = keys.indexOf(selectedImage.id);
do {
addId = keys.get(keyIndex) + 1;
keyIndex++;
} while (dialog.dialogImages.containsKey(addId));
if (keyIndex >= 0 && keyIndex < keys.size() - 1) {
do {
addId = keys.get(keyIndex) + 1;
keyIndex++;
} while (keyIndex < keys.size() && dialog.dialogImages.containsKey(addId));
}
} else if (dialog.dialogImages.size() > 0) {
addId = (Integer) dialog.dialogImages.keySet().toArray()[dialog.dialogImages.size() - 1] + 1;
}
@@ -134,6 +134,7 @@ public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfi
if(gss.selectedResource != null) {
soundSelected.setText(gss.selectedResource.toString());
unFocused(soundSelected);
initGui();
}
}
}
@@ -43,15 +43,14 @@ public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldLis
}
public void buttonEvent(GuiButton button){
if(button.id == 6)
npc.advanced.disablePitch =((GuiNpcButton)button).getValue() == 0;
else{
selectedField = getTextField(button.id);
setSubGui(new GuiSoundSelection(selectedField.getText()));
}
}
@Override
public void unFocused(GuiNpcTextField textfield) {
if(textfield.id == 0)
@@ -72,6 +71,7 @@ public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldLis
if(gss.selectedResource != null) {
selectedField.setText(gss.selectedResource.toString());
unFocused(selectedField);
initGui();
}
}
@@ -132,6 +132,7 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
if(search.equals(getTextField(55).getText()))
return;
search = getTextField(55).getText().toLowerCase();
scrollAnimations.resetScroll();
scrollAnimations.setList(getSearchList());
}
}
@@ -100,6 +100,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
if(catSearch.equals(getTextField(55).getText()))
return;
catSearch = getTextField(55).getText().toLowerCase();
catScroll.resetScroll();
catScroll.setList(getCatSearch());
}
}
@@ -108,6 +109,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
if(diagSearch.equals(getTextField(66).getText()))
return;
diagSearch = getTextField(66).getText().toLowerCase();
dialogScroll.resetScroll();
dialogScroll.setList(getDiagSearch());
}
}
@@ -146,6 +146,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
if(search.equals(getTextField(55).getText()))
return;
search = getTextField(55).getText().toLowerCase();
scrollFactions.resetScroll();
scrollFactions.setList(getSearchList());
}
}
@@ -17,9 +17,9 @@ public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollDa
private GuiCustomScroll scroll;
private List<String> data = new ArrayList<String>();
private String search = "";
public static GuiScreen Instance;
public GuiNPCManageLinkedNpc(EntityNPCInterface npc){
super(npc);
Instance = this;
@@ -29,10 +29,10 @@ public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollDa
@Override
public void initGui(){
super.initGui();
this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.add"));
this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove"));
if(scroll == null){
scroll = new GuiCustomScroll(this,0,0);
scroll.setSize(143, 185);
@@ -54,6 +54,7 @@ public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollDa
return;
search = getTextField(55).getText().toLowerCase();
scroll.setList(getSearchList());
scroll.resetScroll();
}
}
}
@@ -80,7 +81,7 @@ public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollDa
if(scroll.hasSelected())
Client.sendData(EnumPacketServer.LinkedRemove, scroll.getSelected());
}
}
@Override
@@ -99,12 +100,12 @@ public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollDa
@Override
public void setSelected(String selected) {
}
@Override
public void save() {
}
}
@@ -105,6 +105,7 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
if(catSearch.equals(getTextField(55).getText()))
return;
catSearch = getTextField(55).getText().toLowerCase();
catScroll.resetScroll();
catScroll.setList(getCatSearch());
}
}
@@ -113,6 +114,7 @@ public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup,
if(questSearch.equals(getTextField(66).getText()))
return;
questSearch = getTextField(66).getText().toLowerCase();
questScroll.resetScroll();
questScroll.setList(getQuestSearch());
}
}
@@ -21,7 +21,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
private Tag tag = new Tag();
private String selected = null;
private String search = "";
public GuiNPCManageTags(EntityNPCInterface npc)
{
super(npc);
@@ -31,10 +31,10 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
public void initGui()
{
super.initGui();
this.addButton(new GuiNpcButton(0,guiLeft + 368, guiTop + 8, 45, 20, "gui.add"));
this.addButton(new GuiNpcButton(1,guiLeft + 368, guiTop + 32, 45, 20, "gui.remove"));
if(scrollTags == null){
scrollTags = new GuiCustomScroll(this,0, 0);
scrollTags.setSize(143, 185);
@@ -46,7 +46,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
if (tag.id == -1)
return;
this.addTextField(new GuiNpcTextField(0, this, guiLeft + 40, guiTop + 4, 136, 20, tag.name));
getTextField(0).setMaxStringLength(20);
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 8, guiTop + 9));
@@ -60,7 +60,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
addButton(new GuiNpcButton(10, guiLeft + 50, guiTop + 30, 60, 20, color));
addLabel(new GuiNpcLabel(1,"gui.color", guiLeft + 8, guiTop + 35));
getButton(10).setTextColor(tag.color);
addLabel(new GuiNpcLabel(3,"faction.hidden", guiLeft + 8, guiTop + 59));
this.addButton(new GuiNpcButton(3,guiLeft + 50, guiTop + 54, 60, 20, new String[]{"gui.no","gui.yes"},tag.hideTag?1:0));
}
@@ -74,6 +74,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
if(search.equals(getTextField(55).getText()))
return;
search = getTextField(55).getText().toLowerCase();
scrollTags.resetScroll();
scrollTags.setList(getSearchList());
}
}
@@ -100,7 +101,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
while(data.containsKey(name))
name += "_";
Tag tag = new Tag(-1, name, 0x00FF00);
NBTTagCompound compound = new NBTTagCompound();
tag.writeNBT(compound);
Client.sendData(EnumPacketServer.TagSave, compound);
@@ -125,28 +126,28 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
public void setGuiData(NBTTagCompound compound) {
this.tag = new Tag();
tag.readNBT(compound);
setSelected(tag.name);
initGui();
}
@Override
public void setData(Vector<String> list, HashMap<String, Integer> data) {
String name = scrollTags.getSelected();
this.data = data;
scrollTags.setList(getSearchList());
if(name != null)
scrollTags.setSelected(name);
}
@Override
public void setSelected(String selected) {
this.selected = selected;
scrollTags.setSelected(selected);
}
@Override
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
if(guiCustomScroll.id == 0)
@@ -156,21 +157,21 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
Client.sendData(EnumPacketServer.TagGet, data.get(selected));
}
}
public void save() {
if(selected != null && data.containsKey(selected) && tag != null){
NBTTagCompound compound = new NBTTagCompound();
tag.writeNBT(compound);
Client.sendData(EnumPacketServer.TagSave, compound);
}
}
@Override
public void unFocused(GuiNpcTextField guiNpcTextField) {
if(tag.id == -1)
if(tag.id == -1)
return;
if(guiNpcTextField.id == 0) {
String name = guiNpcTextField.getText();
if(!name.isEmpty() && !data.containsKey(name)){
@@ -191,8 +192,8 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
}
tag.color = color;
guiNpcTextField.setTextColor(tag.color);
}
}
}
@Override
@@ -25,7 +25,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
private String selected = null;
private ResourceLocation slot;
private String search = "";
public GuiNpcManageRecipes(EntityNPCInterface npc,ContainerManageRecipes container){
super(npc,container);
this.container = container;
@@ -39,7 +39,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
@Override
public void initGui(){
super.initGui();
if(scroll == null)
scroll = new GuiCustomScroll(this,0,0);
scroll.setSize(130, 180);
@@ -57,7 +57,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
this.addLabel(new GuiNpcLabel(0, "gui.ignoreDamage", guiLeft + 86, guiTop + 32));
this.addButton(new GuiNpcButtonYesNo(5,guiLeft + 114, guiTop + 40, 50, 20, container.recipe.ignoreDamage));
this.addLabel(new GuiNpcLabel(1, "gui.ignoreNBT", guiLeft + 86, guiTop + 82));
this.addButton(new GuiNpcButtonYesNo(6,guiLeft + 114, guiTop + 90, 50, 20, container.recipe.ignoreNBT));
@@ -119,6 +119,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
if(search.equals(getTextField(55).getText()))
return;
search = getTextField(55).getText().toLowerCase();
scroll.resetScroll();
scroll.setList(getSearchList());
}
}
@@ -154,7 +155,7 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
super.drawGuiContainerBackgroundLayer(f, x, y);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(slot);
for(int i = 0; i < container.width;i++){
for(int j = 0; j < container.width;j++){
drawTexturedModalRect(guiLeft + i*18 + 7, guiTop + j*18 + 34, 0, 0, 18, 18);
@@ -170,11 +171,11 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
this.getTextField(0).enabled = name != null;
this.getButton(5).setEnabled(name != null);
if(name != null)
scroll.setSelected(name);
}
@Override
public void setSelected(String selected) {
this.selected = selected;
@@ -94,6 +94,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
if(search.equals(getTextField(55).getText()))
return;
search = getTextField(55).getText().toLowerCase();
scrollNaturalSpawns.resetScroll();
scrollNaturalSpawns.setList(getSearchList());
}
}
@@ -429,7 +429,6 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener,ICu
this.trackedQuestKey = compound.getString("QuestName");
}
this.isLeader = ClientCacheHandler.party.getPartyLeaderName().equals(this.player.getCommandSenderName());
System.out.println("KEY:" + trackedQuestKey);
} else if (compound.hasKey("Disband")) {
this.isLeader = false;
} else if (compound.hasKey("PartyInvites")) {
@@ -100,6 +100,7 @@ public class GuiNpcBard extends GuiNPCInterface2 implements ISubGuiListener
if(gss.selectedResource != null) {
job.song = gss.selectedResource.toString();
getLabel(0).label = job.song;
initGui();
}
}
}
@@ -55,6 +55,7 @@ public class SubGuiNpcConversationLine extends SubGuiInterface implements ITextf
GuiSoundSelection gss = (GuiSoundSelection) subgui;
if(gss.selectedResource != null) {
sound = gss.selectedResource.toString();
initGui();
}
}
@@ -59,6 +59,7 @@ public class GuiScriptPlayers extends GuiScriptInterface {
hookList.add("dialogOpen");
hookList.add("dialogOption");
hookList.add("dialogClose");
hookList.add("scriptCommand");
hookList.add("customGuiClosed");
hookList.add("customGuiButton");
hookList.add("customGuiSlot");
@@ -101,6 +101,7 @@ public class GuiDialogSelection extends SubGuiInterface implements ICustomScroll
if(catSearch.equals(getTextField(33).getText()))
return;
catSearch = getTextField(33).getText().toLowerCase();
scrollCategories.resetScroll();
scrollCategories.setList(getCatSearch());
}
}
@@ -109,6 +110,7 @@ public class GuiDialogSelection extends SubGuiInterface implements ICustomScroll
if(dialogSearch.equals(getTextField(44).getText()))
return;
dialogSearch = getTextField(44).getText().toLowerCase();
scrollDialogs.resetScroll();
scrollDialogs.setList(getDialogSearch());
}
}
@@ -101,6 +101,7 @@ public class GuiQuestSelection extends SubGuiInterface implements ICustomScrollL
if(catSearch.equals(getTextField(33).getText()))
return;
catSearch = getTextField(33).getText().toLowerCase();
scrollCategories.resetScroll();
scrollCategories.setList(getCatSearch());
}
}
@@ -109,6 +110,7 @@ public class GuiQuestSelection extends SubGuiInterface implements ICustomScrollL
if(questSearch.equals(getTextField(44).getText()))
return;
questSearch = getTextField(44).getText().toLowerCase();
scrollQuests.resetScroll();
scrollQuests.setList(getQuestSearch());
}
}
@@ -138,6 +138,7 @@ public class GuiSoundSelection extends SubGuiInterface implements ICustomScrollL
if(catSearch.equals(getTextField(55).getText()))
return;
catSearch = getTextField(55).getText().toLowerCase();
scrollCategories.resetScroll();
scrollCategories.setList(getCatSearch());
}
}
@@ -146,6 +147,7 @@ public class GuiSoundSelection extends SubGuiInterface implements ICustomScrollL
if(soundSearch.equals(getTextField(66).getText()))
return;
soundSearch = getTextField(66).getText().toLowerCase();
scrollSounds.resetScroll();
scrollSounds.setList(getSoundSearch());
}
}
@@ -2,6 +2,7 @@ package noppes.npcs.client.gui.util;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.gui.roles.GuiNpcTraderSetup;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.opengl.GL11;
@@ -32,13 +33,13 @@ public abstract class GuiContainerNPCInterface2 extends GuiContainerNPCInterface
public ResourceLocation getResource(String texture){
return new ResourceLocation("customnpcs","textures/gui/" + texture);
}
@Override
public void initGui()
{
super.initGui();
menu.initGui(guiLeft, guiTop + menuYOffset, xSize);
}
}
@Override
protected void mouseClicked(int i, int j, int k)
@@ -47,7 +48,7 @@ public abstract class GuiContainerNPCInterface2 extends GuiContainerNPCInterface
if(!hasSubGui())
menu.mouseClicked(i, j, k);
}
public void delete(){
npc.delete();
displayGuiScreen(null);
@@ -62,10 +63,13 @@ public abstract class GuiContainerNPCInterface2 extends GuiContainerNPCInterface
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 256, 256);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(defaultBackground2);
drawTexturedModalRect(guiLeft + xSize-230, guiTop, 26, 0, 256, 220);
if(this instanceof GuiNpcTraderSetup)
drawTexturedModalRect(guiLeft + xSize-210, guiTop, 46, 0, 256, 220);
else
drawTexturedModalRect(guiLeft + xSize-230, guiTop, 26, 0, 256, 220);
menu.drawElements(fontRendererObj, i, j, mc, f);
super.drawGuiContainerBackgroundLayer(f, i, j);
}
@@ -2,12 +2,15 @@ package noppes.npcs.client.renderer.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.block.material.MapColor;
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.init.Blocks;
import net.minecraft.item.*;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
@@ -23,7 +26,7 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
private final ModelWallBanner model = new ModelWallBanner();
private final ModelWallBannerFlag flag = new ModelWallBannerFlag();
public BlockWallBannerRenderer(){
((BlockWallBanner)CustomItems.wallBanner).renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(this);
@@ -40,7 +43,7 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
//GL11.glScalef(0.95f, 0.95f, 0.95f);
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
setMaterialTexture(var1.getBlockMetadata());
GL11.glColor3f(1, 1, 1);
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
@@ -60,10 +63,10 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
{
GL11.glPushMatrix();
bindTexture(TextureMap.locationItemsTexture);
GL11.glTranslatef((float)par2 + 0.5f, (float)par4 +1.3f, (float)par6 + 0.5f);
GL11.glTranslatef((float)par2 + 0.5f, (float)par4 +0.2f, (float)par6 + 0.5f);
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(90 * meta, 0, 1, 0);
GL11.glTranslatef(0, 0, -0.14f);
GL11.glTranslatef(0, 0, 0.26f);
GL11.glDepthMask(false);
float f2 = 0.05f;
Minecraft mc = Minecraft.getMinecraft();
@@ -93,6 +96,23 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
}
l = item.getItem().getColorFromItemStack(item, 0);
Item loadingItem = item.getItem();
if(loadingItem instanceof ItemBlock) {
Block block = ((ItemBlock) loadingItem).field_150939_a;
if(block != null){
if(block == Blocks.enchanting_table || block == Blocks.end_portal_frame){
object = block.getIcon(1, item.getItemDamage());
}
else if (block == Blocks.furnace || block == Blocks.tnt){
object = block.getIcon(2, 1);
}
else {
object = block.getIcon(0, item.getItemDamage());
}
}
}
f3 = (float)(l >> 16 & 255) / 255.0F;
f4 = (float)(l >> 8 & 255) / 255.0F;
f = (float)(l & 255) / 255.0F;
@@ -145,7 +165,7 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
public int getRenderId() {
return CustomItems.wallBanner.getRenderType();
}
public int specialRenderDistance(){
return 26;
}
@@ -78,17 +78,21 @@ public class CustomItemRenderer implements IItemRenderer {
float entityRenderTicks = Minecraft.getMinecraft().timer.renderPartialTicks;
float bobbing = MathHelper.sin(((float)entityItem.age + entityRenderTicks) / 10.0F + entityItem.hoverStart) * 0.1F + 0.1F;
GL11.glRotatef(scriptCustomItem.rotationX, 1, 0, 0);
GL11.glRotatef(scriptCustomItem.rotationY, 0, 1, 0);
GL11.glRotatef(scriptCustomItem.rotationZ, 0, 0, 1);
if(!scriptCustomItem.isNormalItem){
GL11.glRotatef(scriptCustomItem.rotationX, 1, 0, 0);
GL11.glRotatef(scriptCustomItem.rotationY, 0, 1, 0);
GL11.glRotatef(scriptCustomItem.rotationZ, 0, 0, 1);
}
GL11.glRotatef(scriptCustomItem.rotationXRate * entityRenderTicks %360, 1, 0, 0);
GL11.glRotatef(scriptCustomItem.rotationYRate * entityRenderTicks %360, 0, 1, 0);
GL11.glRotatef(scriptCustomItem.rotationZRate * entityRenderTicks %360, 0, 0, 1);
if (!renderInFrame) {
GL11.glScalef(scriptCustomItem.scaleX, scriptCustomItem.scaleY, scriptCustomItem.scaleZ);
GL11.glTranslatef(0.0F, (Math.max(scriptCustomItem.scaleY, 1) - 1) * (1.0F / 4), 0.0F);
if(!scriptCustomItem.isNormalItem){
GL11.glScalef(scriptCustomItem.scaleX, scriptCustomItem.scaleY, scriptCustomItem.scaleZ);
GL11.glTranslatef(0.0F, (Math.max(scriptCustomItem.scaleY, 1) - 1) * (1.0F / 4), 0.0F);
}
GL11.glTranslatef(0.0F, -bobbing, 0.0F);
}
@@ -104,22 +108,60 @@ public class CustomItemRenderer implements IItemRenderer {
return;
}
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON && scriptCustomItem.isNormalItem) {
GL11.glPushMatrix();
GL11.glTranslatef(0.9375F, 0.0625F, 0.0F);
GL11.glRotatef(-315.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.135F, 0.2F, 0.07F);
int color = scriptCustomItem.getColor();
float itemRed = (color >> 16 & 255) / 255f;
float itemGreen = (color >> 8 & 255) / 255f;
float itemBlue = (color & 255) / 255f;
GL11.glColor4f(itemRed, itemGreen, itemBlue, 1.0F);
GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.09375F, 0.0625F, 0.0F);
EntityLivingBase entityLivingBase = (EntityLivingBase) data[1];
renderItem3d(scriptCustomItem, entityLivingBase, itemStack);
GL11.glPopMatrix();
return;
}
GL11.glPushMatrix();
GL11.glTranslatef(0.9375F, 0.0625F, 0.0F);
GL11.glRotatef(-315.0F, 0.0F, 0.0F, 1.0F);
((ItemScripted) itemStack.getItem()).renderOffset(scriptCustomItem);
GL11.glTranslatef(scriptCustomItem.translateX, scriptCustomItem.translateY, scriptCustomItem.translateZ);
GL11.glRotatef(scriptCustomItem.rotationX, 1, 0, 0);
GL11.glRotatef(scriptCustomItem.rotationY, 0, 1, 0);
GL11.glRotatef(scriptCustomItem.rotationZ, 0, 0, 1);
if(scriptCustomItem.isNormalItem){
GL11.glTranslatef(-0.05F, 0.3F, 0.3F);
GL11.glRotatef(50, 1, 0, 0);
GL11.glRotatef(-80, 0, 1, 0);
GL11.glRotatef(80, 0, 0, 1);
GL11.glRotatef(scriptCustomItem.rotationXRate * item3dRenderTicks %360, 1, 0, 0);
GL11.glRotatef(scriptCustomItem.rotationYRate * item3dRenderTicks %360, 0, 1, 0);
GL11.glRotatef(scriptCustomItem.rotationZRate * item3dRenderTicks %360, 0, 0, 1);
GL11.glRotatef(scriptCustomItem.rotationXRate * item3dRenderTicks %360, 1, 0, 0);
GL11.glRotatef(scriptCustomItem.rotationYRate * item3dRenderTicks %360, 0, 1, 0);
GL11.glRotatef(scriptCustomItem.rotationZRate * item3dRenderTicks %360, 0, 0, 1);
GL11.glScalef(scriptCustomItem.scaleX, scriptCustomItem.scaleY, scriptCustomItem.scaleZ);
GL11.glScalef(0.6F, 0.6F,0.6F);
}
else {
GL11.glTranslatef(scriptCustomItem.translateX, scriptCustomItem.translateY, scriptCustomItem.translateZ);
GL11.glRotatef(scriptCustomItem.rotationX, 1, 0, 0);
GL11.glRotatef(scriptCustomItem.rotationY, 0, 1, 0);
GL11.glRotatef(scriptCustomItem.rotationZ, 0, 0, 1);
GL11.glRotatef(scriptCustomItem.rotationXRate * item3dRenderTicks %360, 1, 0, 0);
GL11.glRotatef(scriptCustomItem.rotationYRate * item3dRenderTicks %360, 0, 1, 0);
GL11.glRotatef(scriptCustomItem.rotationZRate * item3dRenderTicks %360, 0, 0, 1);
GL11.glScalef(scriptCustomItem.scaleX, scriptCustomItem.scaleY, scriptCustomItem.scaleZ);
}
int color = scriptCustomItem.getColor();
float itemRed = (color >> 16 & 255) / 255f;
@@ -234,7 +276,8 @@ public class CustomItemRenderer implements IItemRenderer {
b0 = 4;
}
GL11.glScalef(scriptCustomItem.scaleX, scriptCustomItem.scaleY, scriptCustomItem.scaleZ);
if(!scriptCustomItem.isNormalItem)
GL11.glScalef(scriptCustomItem.scaleX, scriptCustomItem.scaleY, scriptCustomItem.scaleZ);
GL11.glTranslatef(-f7, -f8, -((f9 + f10) * (float)b0 / 2.0F));
for (int k = 0; k < b0; ++k)