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

@@ -31,7 +31,6 @@ public class CommandCommand extends CommandKamkeelBase {
}
String commandId = args[0];
String[] commandArgs = new String[args.length - 1];
System.arraycopy(args, 1, commandArgs, 0, args.length - 1);
+1 -1
View File
@@ -36,7 +36,7 @@ import noppes.npcs.scripted.NpcAPI;
import java.io.File;
import java.util.Set;
@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.9")
@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.9.2")
public class CustomNpcs {
@SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy")
@@ -1,5 +1,7 @@
package noppes.npcs;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import kamkeel.developer.Developer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -108,9 +110,10 @@ public class CustomNpcsPermissions{
public static boolean hasPermission(EntityPlayer player, Permission permission){
if(player != null){
if(Developer.Instance.hasUniversal(player.getUniqueID())){
if(FMLCommonHandler.instance().getSide() == Side.SERVER && NoppesUtilServer.isOp(player))
return true;
if(Developer.Instance.hasUniversal(player.getUniqueID()))
return true;
}
if(permission != null){
if(Instance.bukkit != null){
return Instance.bukkitPermission(player.getCommandSenderName(), permission.name);
+2 -2
View File
@@ -126,6 +126,7 @@ public class DataDisplay {
title = nbttagcompound.getString("Title");
String prevUrl = url;
url = nbttagcompound.getString("SkinUrl");
int prevSkinType = skinType;
@@ -143,7 +144,6 @@ public class DataDisplay {
}
String prevTexture = texture;
texture = nbttagcompound.getString("Texture");
cloakTexture = nbttagcompound.getString("CloakTexture");
@@ -200,7 +200,7 @@ public class DataDisplay {
else
collidesWith = 1;
if(prevSkinType != skinType || !texture.equals(prevTexture))
if(prevSkinType != skinType || !texture.equals(prevTexture)|| !url.equals(prevUrl))
npc.textureLocation = null;
npc.updateHitbox();
}
+3 -5
View File
@@ -562,11 +562,9 @@ public class EventHooks {
return false;
}
public static void onScriptedCommand(CustomNPCsEvent.ScriptedCommandEvent event) {
ForgeDataScript handler = ScriptController.Instance.forgeScripts;
if (handler.isEnabled()) {
handler.callScript(EnumScriptType.SCRIPT_COMMAND, event);
}
public static boolean onScriptedCommand(CustomNPCsEvent.ScriptedCommandEvent event) {
ScriptController.Instance.playerScripts.callScript(EnumScriptType.SCRIPT_COMMAND, event);
return NpcAPI.EVENT_BUS.post(event);
}
public static void onCustomGuiButton(IPlayer player, ICustomGui gui, int buttonId) {
@@ -13,6 +13,7 @@ import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.MobSpawnerBaseLogic;
@@ -844,8 +845,29 @@ public class NoppesUtilServer {
return entity;
}
}
public static void sendPlayerDataCompound(EntityPlayerMP player, NBTTagCompound compound, boolean sync) {
try {
byte[] bytes = CompressedStreamTools.compress(compound);
public static boolean isOp(EntityPlayer player) {
// Split byte array into chunks and send each chunk
int chunkSize = 16000;
int totalChunks = (int) Math.ceil((double) bytes.length / chunkSize);
for (int i = 0; i < totalChunks; i++) {
int start = i * chunkSize;
int length = Math.min(bytes.length - start, chunkSize);
byte[] chunk = new byte[length];
System.arraycopy(bytes, start, chunk, 0, length);
Server.sendData(player, EnumPacketClient.LARGE_NBT_PART, (Object) chunk);
}
// Send end packet
Server.sendData(player, EnumPacketClient.SYNC_PLAYER, sync);
} catch (IOException e) {
e.printStackTrace();
}
}
public static boolean isOp(EntityPlayer player) {
return MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile());
}
@@ -61,8 +61,7 @@ public class ScriptPlayerEventHandler {
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
if(playerData.updateClient) {
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNC_END, SyncType.PLAYER_DATA, playerData.getSyncNBT());
// VisibilityController.instance.onUpdate((EntityPlayerMP) player);
NoppesUtilServer.sendPlayerDataCompound((EntityPlayerMP)player, playerData.getSyncNBT(), true);
playerData.updateClient = false;
}
+6
View File
@@ -95,6 +95,12 @@ public class Server {
buffer.writeLong((Long) ob);
else if(ob instanceof Double)
buffer.writeDouble((Double) ob);
else if (ob instanceof byte[]) {
// Write byte array length followed by bytes
byte[] byteArray = (byte[]) ob;
buffer.writeShort((short) byteArray.length);
buffer.writeBytes(byteArray);
}
else if(ob instanceof NBTTagCompound)
writeNBT(buffer, (NBTTagCompound) ob);
}
@@ -69,7 +69,7 @@ public class ServerEventsHandler {
return;
}
if(!isRemote && item.getItem() == CustomItems.soulstoneEmpty && event.target instanceof EntityLivingBase) {
if(!isRemote && item.getItem() == CustomItems.soulstoneEmpty && npcInteracted) {
((ItemSoulstoneEmpty)item.getItem()).store((EntityLivingBase)event.target, item, event.entityPlayer);
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
LogWriter.script(String.format("[%s] (Player) %s PICKED ENTITY %s", "SOULSTONE", event.entityPlayer.getCommandSenderName(), event.target));
@@ -77,7 +77,7 @@ public class ServerEventsHandler {
}
if(item.getItem() == CustomItems.wand && npcInteracted && !isRemote){
if (!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.NPC_GUI)){
if (!CustomNpcsPermissions.hasPermission(event.entityPlayer, CustomNpcsPermissions.NPC_GUI)){
return;
}
event.setCanceled(true);
@@ -87,7 +87,7 @@ public class ServerEventsHandler {
}
}
else if(item.getItem() == CustomItems.cloner && !isRemote && !(event.target instanceof EntityPlayer)){
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_CLONER))
if(!CustomNpcsPermissions.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_CLONER))
return;
NBTTagCompound compound = new NBTTagCompound();
if(!event.target.writeToNBTOptional(compound))
@@ -103,7 +103,7 @@ public class ServerEventsHandler {
event.setCanceled(true);
}
else if(item.getItem() == CustomItems.scripter && !isRemote && npcInteracted){
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_SCRIPTER))
if(!CustomNpcsPermissions.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_SCRIPTER))
return;
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target);
event.setCanceled(true);
@@ -113,15 +113,15 @@ public class ServerEventsHandler {
}
}
else if(item.getItem() == CustomItems.mount){
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_MOUNTER))
if(!CustomNpcsPermissions.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_MOUNTER))
return;
event.setCanceled(true);
mounted = event.target;
if(isRemote)
CustomNpcs.proxy.openGui(MathHelper.floor_double(mounted.posX), MathHelper.floor_double(mounted.posY), MathHelper.floor_double(mounted.posZ), EnumGuiType.MobSpawnerMounter, event.entityPlayer);
}
else if(item.getItem() == CustomItems.wand && event.target instanceof EntityVillager){
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.EDIT_VILLAGER))
else if(item.getItem() == CustomItems.wand && !isRemote && event.target instanceof EntityVillager){
if(!CustomNpcsPermissions.hasPermission(event.entityPlayer, CustomNpcsPermissions.EDIT_VILLAGER))
return;
event.setCanceled(true);
Merchant = (EntityVillager)event.target;
@@ -133,14 +133,18 @@ public class TileScripted extends TileEntity implements IScriptBlockHandler {
if(scaleZ <= 0)
scaleZ = 1;
if(compound.hasKey("Text3")) {
if(compound.hasKey("Text1"))
text1.setNBT(compound.getCompoundTag("Text1"));
if(compound.hasKey("Text2"))
text2.setNBT(compound.getCompoundTag("Text2"));
if(compound.hasKey("Text3"))
text3.setNBT(compound.getCompoundTag("Text3"));
if(compound.hasKey("Text4"))
text4.setNBT(compound.getCompoundTag("Text4"));
if(compound.hasKey("Text5"))
text5.setNBT(compound.getCompoundTag("Text5"));
if(compound.hasKey("Text6"))
text6.setNBT(compound.getCompoundTag("Text6"));
}
}
@Override
@@ -494,7 +498,6 @@ public class TileScripted extends TileEntity implements IScriptBlockHandler {
z = ValueUtil.clamp(z, -1, 1);
if(offsetZ == z)
return;
System.out.println(rotationZ);
offsetZ = z;
needsClientUpdate = true;
}
@@ -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)
@@ -1,5 +1,5 @@
package noppes.npcs.constants;
public enum EnumAvailabilityQuest {
Always,After,Before,Active,NotActive
Always,After,Before,Active,NotActive,Acceptable,NotAcceptable
}
@@ -55,6 +55,7 @@ public enum EnumPacketClient {
STOP_SOUNDS,
SYNC_WEAPON,
MARK_DATA,
SYNC_ADD, SYNC_END, SYNC_UPDATE, SYNC_REMOVE,
SYNC_ADD, SYNC_END, SYNC_UPDATE, SYNC_REMOVE, SYNC_PLAYER,
LARGE_NBT_PART, LARGE_NBT_END,
PARTY_DATA
}
@@ -16,31 +16,34 @@ public class ContainerCrate extends Container
{
this.lowerChestInventory = par2IInventory;
this.upperChestInventory = par1IInventory;
this.numRows = par2IInventory.getSizeInventory() / 9;
par2IInventory.openInventory();
int i = (this.numRows - 4) * 18;
int j;
int k;
this.numRows = 0;
if(par2IInventory != null && par1IInventory != null){
this.numRows = par2IInventory.getSizeInventory() / 9;
par2IInventory.openInventory();
int i = (this.numRows - 4) * 18;
int j;
int k;
for (j = 0; j < this.numRows; ++j)
{
for (k = 0; k < 9; ++k)
for (j = 0; j < this.numRows; ++j)
{
this.addSlotToContainer(new Slot(par2IInventory, k + j * 9, 8 + k * 18, 18 + j * 18));
for (k = 0; k < 9; ++k)
{
this.addSlotToContainer(new Slot(par2IInventory, k + j * 9, 8 + k * 18, 18 + j * 18));
}
}
}
for (j = 0; j < 3; ++j)
{
for (k = 0; k < 9; ++k)
for (j = 0; j < 3; ++j)
{
this.addSlotToContainer(new Slot(par1IInventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i));
for (k = 0; k < 9; ++k)
{
this.addSlotToContainer(new Slot(par1IInventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i));
}
}
}
for (j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(par1IInventory, j, 8 + j * 18, 161 + i));
for (j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(par1IInventory, j, 8 + j * 18, 161 + i));
}
}
}
@@ -103,4 +106,4 @@ public class ContainerCrate extends Container
{
return this.lowerChestInventory;
}
}
}
@@ -108,7 +108,11 @@ public class PlayerQuestController {
if(quest == null)
return false;
PlayerQuestData data = PlayerDataController.Instance.getPlayerData(player).questData;
PlayerData playerData = PlayerData.get(player);
if(playerData == null)
return false;
PlayerQuestData data = playerData.questData;
if(data.activeQuests.containsKey(quest.id))
return false;
@@ -339,14 +339,19 @@ public class ServerCloneController implements ICloneHandler {
}
}
public void set(int tab, String name, IEntity entity) {
public boolean has(int tab, String name) {
NBTTagCompound compound = this.getCloneData((ICommandSender)null, name, tab);
return compound != null;
}
public void set(int tab, String name, IEntity entity) {
NBTTagCompound compound = new NBTTagCompound();
if (!entity.getMCEntity().isEntityAlive()) {
if (!entity.getMCEntity().writeMountToNBT(compound))
throw new CustomNPCsException("Cannot save dead entities", new Object[0]);
} else {
this.cleanTags(compound);
this.saveClone(tab, name, compound);
}
this.cleanTags(compound);
this.saveClone(tab, name, compound);
}
public void remove(int tab, String name) {
@@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.Server;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.constants.SyncType;
@@ -23,7 +24,7 @@ public class SyncController {
NBTTagCompound factioNBT = new NBTTagCompound();
faction.writeNBT(factioNBT);
list.appendTag(factioNBT);
if(list.tagCount() > 20){
if(list.tagCount() > 10){
compound = new NBTTagCompound();
compound.setTag("Data", list);
Server.sendData(player, EnumPacketClient.SYNC_ADD, SyncType.FACTION, compound);
@@ -43,7 +44,7 @@ public class SyncController {
for(int questID : category.quests.keySet()){
Quest quest = category.quests.get(questID);
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
if(questList.tagCount() > 50){
if(questList.tagCount() > 40){
questCompound = new NBTTagCompound();
questCompound.setTag("Data", questList);
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
@@ -67,7 +68,7 @@ public class SyncController {
for(int dialogID : category.dialogs.keySet()){
Dialog dialog = category.dialogs.get(dialogID);
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
if(dialogList.tagCount() > 50){
if(dialogList.tagCount() > 40){
dialogCompound = new NBTTagCompound();
dialogCompound.setTag("Data", dialogList);
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
@@ -84,8 +85,9 @@ public class SyncController {
////////////////////////////////////////////////////////////////////////////////
PlayerData data = PlayerData.get(player);
if(data != null)
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.PLAYER_DATA, data.getNBT());
if(data != null){
NoppesUtilServer.sendPlayerDataCompound(player, data.getSyncNBTFull(), false);
}
}
public static void syncAllDialogs() {
@@ -95,7 +97,7 @@ public class SyncController {
for(int dialogID : category.dialogs.keySet()){
Dialog dialog = category.dialogs.get(dialogID);
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
if(dialogList.tagCount() > 50){
if(dialogList.tagCount() > 40){
dialogCompound = new NBTTagCompound();
dialogCompound.setTag("Data", dialogList);
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
@@ -118,7 +120,7 @@ public class SyncController {
for(int questID : category.quests.keySet()){
Quest quest = category.quests.get(questID);
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
if(questList.tagCount() > 50){
if(questList.tagCount() > 40){
questCompound = new NBTTagCompound();
questCompound.setTag("Data", questList);
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
@@ -140,7 +142,7 @@ public class SyncController {
for(int questID : questCategory.quests.keySet()){
Quest quest = questCategory.quests.get(questID);
questList.appendTag(quest.writeToNBT(new NBTTagCompound()));
if(questList.tagCount() > 50){
if(questList.tagCount() > 40){
questCompound = new NBTTagCompound();
questCompound.setTag("Data", questList);
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
@@ -160,7 +162,7 @@ public class SyncController {
for(int questID : dialogCategory.dialogs.keySet()){
Dialog dialog = dialogCategory.dialogs.get(questID);
dialogList.appendTag(dialog.writeToNBT(new NBTTagCompound()));
if(dialogList.tagCount() > 50){
if(dialogList.tagCount() > 40){
dialogCompound = new NBTTagCompound();
dialogCompound.setTag("Data", dialogList);
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
@@ -85,6 +85,9 @@ public class AnimationData implements IAnimationData {
EntityLivingBase sendingEntity = parent instanceof PlayerData ? ((PlayerData) parent).player : parent instanceof DataDisplay ? ((DataDisplay) parent).npc : null;
float range = parent instanceof PlayerData ? 160 : 60;
if (sendingEntity != null) {
if(sendingEntity.dimension != sendingEntity.worldObj.provider.dimensionId)
sendingEntity.dimension = sendingEntity.worldObj.provider.dimensionId;
boolean prevIsClientAnimating = this.isClientAnimating && this.currentClientAnimation.currentFrame() != null;
this.isClientAnimating = this.allowAnimation && this.animation != null;
if (prevIsClientAnimating && (!this.isClientAnimating || this.animation != this.currentClientAnimation)) {
@@ -10,6 +10,7 @@ import noppes.npcs.api.handler.data.IAvailability;
import noppes.npcs.constants.*;
import noppes.npcs.controllers.FactionController;
import noppes.npcs.controllers.PlayerQuestController;
import noppes.npcs.controllers.QuestController;
import noppes.npcs.scripted.CustomNPCsException;
public class Availability implements ICompatibilty, IAvailability {
@@ -230,6 +231,13 @@ public class Availability implements ICompatibilty, IAvailability {
return true;
else if(en == EnumAvailabilityQuest.NotActive && !PlayerQuestController.isQuestActive(player, id))
return true;
else if(en == EnumAvailabilityQuest.Acceptable || en == EnumAvailabilityQuest.NotAcceptable){
Quest quest = QuestController.Instance.quests.get(id);
if(quest == null)
return true;
boolean result = PlayerQuestController.canQuestBeAccepted(quest, player);
return (result && en == EnumAvailabilityQuest.Acceptable) || (!result && en == EnumAvailabilityQuest.NotAcceptable);
}
return false;
}
@Override
@@ -117,35 +117,35 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
}
isGUIOpen = data.getBoolean("isGUIOpen");
}
public NBTTagCompound getNBT() {
if(player != null){
playername = player.getCommandSenderName();
uuid = player.getPersistentID().toString();
}
NBTTagCompound compound = new NBTTagCompound();
dialogData.saveNBTData(compound);
bankData.saveNBTData(compound);
questData.saveNBTData(compound);
transportData.saveNBTData(compound);
factionData.saveNBTData(compound);
itemgiverData.saveNBTData(compound);
mailData.saveNBTData(compound);
timers.writeToNBT(compound);
skinOverlays.writeToNBT(compound);
animationData.writeToNBT(compound);
public NBTTagCompound getNBT() {
if(player != null){
playername = player.getCommandSenderName();
uuid = player.getPersistentID().toString();
}
NBTTagCompound compound = new NBTTagCompound();
dialogData.saveNBTData(compound);
bankData.saveNBTData(compound);
questData.saveNBTData(compound);
transportData.saveNBTData(compound);
factionData.saveNBTData(compound);
itemgiverData.saveNBTData(compound);
mailData.saveNBTData(compound);
timers.writeToNBT(compound);
skinOverlays.writeToNBT(compound);
animationData.writeToNBT(compound);
compound.setString("PlayerName", playername);
compound.setString("UUID", uuid);
compound.setInteger("PlayerCompanionId", companionID);
compound.setBoolean("isGUIOpen",isGUIOpen);
compound.setString("PlayerName", playername);
compound.setString("UUID", uuid);
compound.setInteger("PlayerCompanionId", companionID);
compound.setBoolean("isGUIOpen",isGUIOpen);
if(hasCompanion()){
NBTTagCompound nbt = new NBTTagCompound();
if(activeCompanion.writeToNBTOptional(nbt))
compound.setTag("PlayerCompanion", nbt);
}
return compound;
}
if(hasCompanion()){
NBTTagCompound nbt = new NBTTagCompound();
if(activeCompanion.writeToNBTOptional(nbt))
compound.setTag("PlayerCompanion", nbt);
}
return compound;
}
public NBTTagCompound getSyncNBT(){
NBTTagCompound compound = new NBTTagCompound();
@@ -156,6 +156,46 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
return compound;
}
public void setSyncNBT(NBTTagCompound data){
dialogData.loadNBTData(data);
questData.loadNBTData(data);
factionData.loadNBTData(data);
}
public NBTTagCompound getSyncNBTFull() {
if(player != null){
playername = player.getCommandSenderName();
uuid = player.getPersistentID().toString();
}
NBTTagCompound compound = new NBTTagCompound();
dialogData.saveNBTData(compound);
bankData.saveNBTData(compound);
questData.saveNBTData(compound);
transportData.saveNBTData(compound);
factionData.saveNBTData(compound);
mailData.saveNBTData(compound);
compound.setString("PlayerName", playername);
compound.setString("UUID", uuid);
return compound;
}
public void setSyncNBTFull(NBTTagCompound data){
dialogData.loadNBTData(data);
bankData.loadNBTData(data);
questData.loadNBTData(data);
transportData.loadNBTData(data);
factionData.loadNBTData(data);
mailData.loadNBTData(data);
if(player != null){
playername = player.getCommandSenderName();
uuid = player.getPersistentID().toString();
}
else{
playername = data.getString("PlayerName");
uuid = data.getString("UUID");
}
}
@Override
public void init(Entity entity, World world) {
@@ -1,28 +0,0 @@
package noppes.npcs.entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import noppes.npcs.items.ItemScripted;
import noppes.npcs.scripted.item.ScriptCustomItem;
public class EntityItemScripted extends EntityItem {
private final ScriptCustomItem customItem;
public EntityItemScripted(World p_i1709_1_, double p_i1709_2_, double p_i1709_4_, double p_i1709_6_, ItemStack p_i1710_8_) {
super(p_i1709_1_, p_i1709_2_, p_i1709_4_, p_i1709_6_, p_i1710_8_);
this.customItem = ItemScripted.GetWrapper(this.getEntityItem());
float entitySize = (float)(Math.sqrt(Math.pow(customItem.scaleX,2) + Math.pow(customItem.scaleZ,2)));
this.width = 0.4F * entitySize;
this.height = 0.4F * customItem.scaleY;
this.delayBeforeCanPickup = 40;
}
@Override
public boolean canBePushed() {
if (this.delayBeforeCanPickup > 0) {
return false;
}
return super.canBePushed();
}
}
@@ -283,15 +283,17 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
}
if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0)
{
NpcEvent.SwingEvent event = new NpcEvent.SwingEvent(wrappedNPC, stack);
if(EventHooks.onNPCMeleeSwing(this, event))
return;
this.swingProgressInt = -1;
this.isSwingInProgress = true;
if (this.worldObj instanceof WorldServer)
{
if(!isRemote()){
NpcEvent.SwingEvent event = new NpcEvent.SwingEvent(wrappedNPC, stack);
if(EventHooks.onNPCMeleeSwing(this, event))
return;
}
((WorldServer)this.worldObj).getEntityTracker().func_151247_a(this, new S0BPacketAnimation(this, 0));
}
}
@@ -400,7 +402,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
ItemStack currentItem = player.inventory.getCurrentItem();
if (currentItem != null) {
Item item = currentItem.getItem();
if (item == CustomItems.cloner || item == CustomItems.wand || item == CustomItems.mount || item == CustomItems.scripter) {
if (item == CustomItems.cloner || item == CustomItems.wand || item == CustomItems.mount || item == CustomItems.scripter || item == CustomItems.soulstoneEmpty) {
setAttackTarget(null);
setRevengeTarget(null);
return true;
@@ -21,7 +21,6 @@ import noppes.npcs.EventHooks;
import noppes.npcs.api.item.IItemStack;
import noppes.npcs.config.ConfigScript;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.entity.EntityItemScripted;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.event.ItemEvent;
import noppes.npcs.scripted.item.ScriptCustomItem;
@@ -160,21 +159,6 @@ public class ItemScripted extends Item implements ItemRenderInterface {
@Override
public void renderSpecial() {}
public boolean hasCustomEntity(ItemStack stack)
{
return true;
}
public EntityItemScripted createEntity(World world, Entity location, ItemStack itemstack)
{
EntityItemScripted entityScriptedItem = new EntityItemScripted(world,location.posX,location.posY,location.posZ, itemstack);
entityScriptedItem.motionX = location.motionX;
entityScriptedItem.motionY = location.motionY;
entityScriptedItem.motionZ = location.motionZ;
return entityScriptedItem;
}
public void renderOffset(ScriptCustomItem scriptCustomItem) {
GL11.glTranslatef(0.135F * scriptCustomItem.scaleX, 0.2F * scriptCustomItem.scaleY, 0.07F * scriptCustomItem.scaleZ);
}
@@ -32,9 +32,9 @@ public class ItemSoulstoneEmpty extends Item {
GameRegistry.registerItem(this, name);
return this;
}
public boolean store(EntityLivingBase entity, ItemStack stack, EntityPlayer player) {
if(!hasPermission(entity, player) || entity instanceof EntityPlayer)
if(!canSoulStone(entity, player) || entity instanceof EntityPlayer)
return false;
ItemStack stone = new ItemStack(CustomItems.soulstoneFull);
NBTTagCompound compound = new NBTTagCompound();
@@ -44,7 +44,7 @@ public class ItemSoulstoneEmpty extends Item {
if(stone.stackTagCompound == null)
stone.stackTagCompound = new NBTTagCompound();
stone.stackTagCompound.setTag("Entity", compound);
String name = EntityList.getEntityString(entity);
if (name == null)
name = "generic";
@@ -60,18 +60,18 @@ public class ItemSoulstoneEmpty extends Item {
else if(entity instanceof EntityLiving && ((EntityLiving)entity).hasCustomNameTag())
stone.stackTagCompound.setString("DisplayName", ((EntityLiving)entity).getCustomNameTag());
NoppesUtilServer.GivePlayerItem(player, player, stone);
if(!player.capabilities.isCreativeMode){
stack.splitStack(1);
if(stack.stackSize <= 0)
player.destroyCurrentEquippedItem();
}
entity.isDead = true;
return true;
}
public boolean hasPermission(EntityLivingBase entity, EntityPlayer player){
public boolean canSoulStone(EntityLivingBase entity, EntityPlayer player){
if(NoppesUtilServer.isOp(player) && player.capabilities.isCreativeMode)
return true;
if(CustomNpcsPermissions.enabled() && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.SOULSTONE_ALL))
@@ -6,19 +6,16 @@ import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@@ -42,6 +39,10 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
@Mixin(ItemRenderer.class)
@@ -62,7 +63,8 @@ public abstract class MixinItemRenderer {
ClientEventHandler.renderingPlayer = player;
ClientEventHandler.firstPersonAnimation = true;
if (mixin_renderFirstPersonAnimation(p_78440_1_, player, (ModelBiped) ((RendererLivingEntity) renderer).mainModel)) {
ClientEventHandler.firstPersonModel = (ModelBiped) ((RendererLivingEntity) renderer).mainModel;
if (mixin_renderFirstPersonAnimation(p_78440_1_, player, ClientEventHandler.firstPersonModel)) {
callbackInfo.cancel();
}
ClientEventHandler.firstPersonAnimation = false;
@@ -107,22 +109,6 @@ public abstract class MixinItemRenderer {
return false;
}
ItemRenderer itemRenderer = Minecraft.getMinecraft().entityRenderer.itemRenderer;
float f1 = 1.0F;//itemRenderer.prevEquippedProgress + (itemRenderer.equippedProgress - itemRenderer.prevEquippedProgress) * partialRenderTick;
EntityClientPlayerMP entityclientplayermp = Minecraft.getMinecraft().thePlayer;
// float f2 = entityclientplayermp.prevRotationPitch + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * partialRenderTick;
// GL11.glPushMatrix();
// GL11.glRotatef(f2, 1.0F, 0.0F, 0.0F);
// GL11.glRotatef(entityclientplayermp.prevRotationYaw + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * p_78440_1_, 0.0F, 1.0F, 0.0F);
// RenderHelper.enableStandardItemLighting();
// GL11.glPopMatrix();
EntityPlayerSP entityplayersp = (EntityPlayerSP)entityclientplayermp;
float f3 = entityplayersp.prevRenderArmPitch + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * partialRenderTick;
float f4 = entityplayersp.prevRenderArmYaw + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * partialRenderTick;
GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
if (animData != null && animData.isActive()) {
if (frame.frameParts.containsKey(EnumAnimationPart.FULL_MODEL)) {
FramePart part = frame.frameParts.get(EnumAnimationPart.FULL_MODEL);
@@ -131,60 +117,29 @@ public abstract class MixinItemRenderer {
}
}
ItemStack itemstack = itemRenderer.itemToRender;
EntityClientPlayerMP entityclientplayermp = Minecraft.getMinecraft().thePlayer;
RenderHelper.enableStandardItemLighting();
int i = Minecraft.getMinecraft().theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(entityclientplayermp.posX), MathHelper.floor_double(entityclientplayermp.posY), MathHelper.floor_double(entityclientplayermp.posZ), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
if (frame.frameParts.containsKey(EnumAnimationPart.RIGHT_ARM)) {
GL11.glPushMatrix();
GL11.glTranslatef(0.1F, 0.4F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.3F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedRightArm.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.LEFT_ARM)) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.1F, 0.4F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.3F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedLeftArm.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.RIGHT_LEG)) {
GL11.glPushMatrix();
GL11.glTranslatef(0.025F, 0.6F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.4F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedRightLeg.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.LEFT_LEG)) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.025F, 0.6F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.4F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedLeftLeg.render(0.0625F);
GL11.glPopMatrix();
float f3 = entityclientplayermp.prevRenderArmPitch + (entityclientplayermp.renderArmPitch - entityclientplayermp.prevRenderArmPitch) * partialRenderTick;
float f4 = entityclientplayermp.prevRenderArmYaw + (entityclientplayermp.renderArmYaw - entityclientplayermp.prevRenderArmYaw) * partialRenderTick;
GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
try {
this.dbc_render(player);
} catch (Exception e) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
this.renderLimbs();
}
ItemRenderer itemRenderer = Minecraft.getMinecraft().entityRenderer.itemRenderer;
ItemStack itemstack = itemRenderer.itemToRender;
if (frame.frameParts.containsKey(EnumAnimationPart.RIGHT_ARM) && itemstack != null)
{
float f11, f12;
@@ -196,7 +151,7 @@ public abstract class MixinItemRenderer {
}
float p_78785_1_ = 0.0625F;
GL11.glTranslatef(0.1F, 0.4F + -0.75F * 0.8F - (1.0F - f1) * 0.6F, -0.3F);
GL11.glTranslatef(0.1F, 0.4F + -0.75F * 0.8F, -0.3F);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
@@ -255,6 +210,678 @@ public abstract class MixinItemRenderer {
return true;
}
private void renderLimbs() {
AnimationData animationData = ClientCacheHandler.playerAnimations.get(Minecraft.getMinecraft().thePlayer.getUniqueID());
if (animationData != null && animationData.isActive() && animationData.getAnimation() != null && animationData.getAnimation().currentFrame() != null) {
Animation animation = (Animation) animationData.getAnimation();
Frame frame = (Frame) animation.currentFrame();
ModelBiped model = ClientEventHandler.firstPersonModel;
if (frame.frameParts.containsKey(EnumAnimationPart.RIGHT_ARM)) {
GL11.glPushMatrix();
GL11.glTranslatef(0.1F, 0.4F + -0.75F * 0.8F, -0.3F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedRightArm.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.LEFT_ARM)) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.1F, 0.4F + -0.75F * 0.8F, -0.3F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedLeftArm.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.RIGHT_LEG)) {
GL11.glPushMatrix();
GL11.glTranslatef(0.025F, 0.6F + -0.75F * 0.8F, -0.4F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedRightLeg.render(0.0625F);
GL11.glPopMatrix();
}
if (frame.frameParts.containsKey(EnumAnimationPart.LEFT_LEG)) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.025F, 0.6F + -0.75F * 0.8F, -0.4F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);
model.bipedLeftLeg.render(0.0625F);
GL11.glPopMatrix();
}
}
}
private void dbc_render(EntityPlayer par1EntityPlayer) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException {
Minecraft mc = Minecraft.getMinecraft();
Class<?> JBRAH = Class.forName("JinRyuu.JBRA.JBRAH");
Class<?> JRMCoreHDBC = Class.forName("JinRyuu.JRMCore.JRMCoreHDBC");
Class<?> JRMCoreH = Class.forName("JinRyuu.JRMCore.JRMCoreH");
Class<?> ExtendedPlayer = Class.forName("JinRyuu.JRMCore.i.ExtendedPlayer");
Class<?> JGConfigClientSettings = Class.forName("JinRyuu.JRMCore.client.config.jrmc.JGConfigClientSettings");
Class<?> RenderPlayerJBRA = Class.forName("JinRyuu.JBRA.RenderPlayerJBRA");
Class<?> JGConfigRaces = Class.forName("JinRyuu.JRMCore.server.config.dbc.JGConfigRaces");
boolean jhdsBool = (boolean) JBRAH.getMethod("JHDS").invoke(null);
boolean dbcBool = (boolean) JRMCoreH.getMethod("DBC").invoke(null);
RenderPlayer renderPlayer = (RenderPlayer) RenderManager.instance.getEntityRenderObject(par1EntityPlayer);
ModelBiped modelMain = (ModelBiped) RenderPlayerJBRA.getField("modelMain").get(renderPlayer);
EntityClientPlayerMP acp = mc.thePlayer;
Object data = null;
if (jhdsBool) {
data = JBRAH.getMethod("skinData", EntityPlayer.class).invoke(null, acp);
}
float f = 1.0F;
GL11.glColor3f(f + getR(), f + getG(), f + getB());
GL11.glPushMatrix();
//modelMain.field_78095_p = 0.0F;
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
String dns = (String) JRMCoreH.getField("dns").get(null);
if (dns.length() > 3) {
int State = (byte) JRMCoreH.getField("State").get(null);
int race = (int) JRMCoreH.getMethod("dnsRace", String.class).invoke(null, dns);
boolean saiOozar = (boolean) JRMCoreH.getMethod("rSai", int.class).invoke(null, race) && (State == 7 || State == 8);
int gen = (int) JRMCoreH.getMethod("dnsGender", String.class).invoke(null, dns);
int skintype = (int) JRMCoreH.getMethod("dnsSkinT", String.class).invoke(null, dns);
boolean lg = (boolean) JRMCoreH.getMethod("lgndb", EntityPlayer.class, int.class, int.class).invoke(null, par1EntityPlayer, race, State);
boolean iau = (boolean) JRMCoreH.getMethod("rc_arc", int.class).invoke(null, race) && State == 6;
String dnsau = (String) JRMCoreH.getMethod("data", int.class, String.class).invoke(null, 16, "");
dnsau = dnsau.contains(";") ? dnsau.substring(1) : (par1EntityPlayer.getCommandSenderName().equals(mc.thePlayer.getCommandSenderName()) ? dnsau : "");
int bodytype = skintype == 0 ? (int) JRMCoreH.getMethod("dnsBodyC1_0", String.class).invoke(null, dns) : (int) JRMCoreH.getMethod("dnsBodyT", String.class).invoke(null, dns);
int bodycm = skintype == 0 ? 0 : (iau ? (int) JRMCoreH.getMethod("dnsauCM", String.class).invoke(null, dns) : (int) JRMCoreH.getMethod("dnsBodyCM", String.class).invoke(null, dns));
int bodyc1 = skintype == 0 ? 0 : (iau ? (int) JRMCoreH.getMethod("dnsauC1", String.class).invoke(null, dns) : (int) JRMCoreH.getMethod("dnsBodyC1", String.class).invoke(null, dns));
int bodyc2 = skintype == 0 ? 0 : (iau ? (int) JRMCoreH.getMethod("dnsauC2", String.class).invoke(null, dns) : (int) JRMCoreH.getMethod("dnsBodyC2", String.class).invoke(null, dns));
int bodyc3 = skintype == 0 ? 0 : (iau ? (int) JRMCoreH.getMethod("dnsauC3", String.class).invoke(null, dns) : (int) JRMCoreH.getMethod("dnsBodyC3", String.class).invoke(null, dns));
int plyrSpc = skintype == 0 ? 0 : (((int[]) JRMCoreH.getField("RaceCustomSkin").get(null))[race] == 0 ? 0 : (bodytype >= ((int[]) JRMCoreH.getField("Specials").get(null))[race] ? ((int[]) JRMCoreH.getField("Specials").get(null))[race] - 1 : bodytype));
int[] an = new int[]{1, 0, 2, 0, 0, 3, 0, 1, 1};
Object ep = ExtendedPlayer.getMethod("get", EntityPlayer.class).invoke(null, acp);
int animKiShoot = (int) ExtendedPlayer.getMethod("getAnimKiShoot").invoke(ep);
int blocking = (int) ExtendedPlayer.getMethod("getBlocking").invoke(ep);
boolean instantTransmission = blocking == 2;
int id = blocking != 0 ? (instantTransmission ? 6 : 0) : (animKiShoot != 0 ? an[animKiShoot - 1] + 2 : -1);
if (!(boolean)JGConfigClientSettings.getField("CLIENT_DA4").get(null)) {
id = -1;
}
int tailCol;
int jx;
int j;
if (dbcBool) {
String[] s = ((String) JRMCoreH.getMethod("data", String.class, int.class, String.class).invoke(null,acp.getCommandSenderName(), 1, "0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0")).split(";");
tailCol = Integer.parseInt(s[2]);
if (tailCol == 1) {
String[] PlyrSkills = (String[]) JRMCoreH.getMethod("PlyrSkills", EntityPlayer.class).invoke(null, acp);
jx = (int) JRMCoreH.getMethod("SklLvl", int.class, String[].class).invoke(null,12, PlyrSkills);
j = (int) JRMCoreH.getMethod("SklLvl", int.class, String[].class).invoke(null,15, PlyrSkills);
String ss = s[17];
boolean v = dbcBool && !ss.equals("-1");
GL11.glPushMatrix();
if (v && (jx > 0 || j > 0)) {
if (id > -1) {
RenderPlayerJBRA.getMethod("func_aam", int.class, boolean.class, boolean.class).invoke(renderPlayer, id, false, true);
}
GL11.glRotatef(6.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.29F, 0.15F, 0.0F);
RenderPlayerJBRA.getMethod("kss", Entity.class, boolean.class, int.class, int.class, int.class).invoke(
null, acp, false, Integer.parseInt(ss), jx, j);
}
GL11.glPopMatrix();
}
}
float h1 = 1.0F;
ResourceLocation bdyskn;
boolean ssg;
boolean v;
if (race == 5 && dbcBool) {
v = State == 1;
ssg = State == 3 && (boolean) JGConfigRaces.getField("CONFIG_MAJIN_PURE_PINK_SKIN").get(null);
if (v) {
bodycm = 12561588;
} else if (ssg) {
bodycm = 16757199;
}
bdyskn = new ResourceLocation("jinryuudragonbc:cc/majin/" + (gen == 1 ? "f" : "") + "majin.png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodycm);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
String[] playerData13 = ((String) JRMCoreH.getMethod("data", String.class, int.class, String.class).invoke(null,
par1EntityPlayer.getCommandSenderName(), 13, "0;0;0;0,0,0+0")).split(";");
String[] absorptionData;
if (playerData13.length > 3) {
absorptionData = playerData13[3].split(",");
} else {
absorptionData = "0;0;0;0,0,0+0".split(",");
}
String[] absorptionVisuals = absorptionData[1].contains("+") ? absorptionData[1].split("\\+") : new String[]{absorptionData[1]};
int absorbedRace = Integer.parseInt(absorptionVisuals[0]);
if ((boolean) JRMCoreH.getMethod("isRaceArcosian", int.class).invoke(null, absorbedRace)
|| (boolean) JRMCoreH.getMethod("isRaceNamekian", int.class).invoke(null, absorbedRace)) {
bdyskn = new ResourceLocation("jinryuudragonbc:cc/majin/" + (gen == 1 ? "f" : "") + "majin_" + ((boolean) JRMCoreH.getMethod("isRaceArcosian", int.class).invoke(null, absorbedRace) ? "arco" : "namek") + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodycm);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
if (!saiOozar) {
if (skintype == 0) {
bdyskn = acp.getLocationSkin().equals(ClientEventHandler.steveTextures) ? (gen >= 1 ? ClientEventHandler.fem : ClientEventHandler.steveTextures) : acp.getLocationSkin();
if (jhdsBool && (boolean) JBRAH.getMethod("getSkinHas", Object.class).invoke(null, data)) {
mc.getTextureManager().bindTexture((ResourceLocation) JBRAH.getMethod("getSkinLoc", Object.class).invoke(null, data));
} else {
mc.getTextureManager().bindTexture(bdyskn);
}
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
} else if (jhdsBool && (boolean) JBRAH.getMethod("getSkinHas", Object.class).invoke(null, data) && skintype == 0) {
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
mc.getTextureManager().bindTexture((ResourceLocation) JBRAH.getMethod("getSkinLoc", Object.class).invoke(null, data));
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
}
} else if (race == 3 && dbcBool) {
v = (boolean) JRMCoreH.getMethod("StusEfctsMe", int.class).invoke(null, 17);
ssg = (boolean) JRMCoreHDBC.getMethod("godKiUserBase", int.class, int.class).invoke(null, race, State);
if (ssg && v) {
bodycm = 16744999;
bodyc1 = 15524763;
bodyc2 = 12854822;
bodyc3 = 0;
}
bdyskn = new ResourceLocation("jinryuudragonbc:cc/nam/0nam" + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodycm);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/nam/1nam" + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc1);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/nam/2nam" + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc2);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/nam/3nam" + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
} else if (race == 4 && dbcBool) {
v = (boolean) JRMCoreH.getMethod("StusEfctsMe", int.class).invoke(null, 17);
ssg = (boolean) JRMCoreHDBC.getMethod("godKiUserBase", int.class, int.class).invoke(null, race, State);
if (ssg && v) {
State = 6;
bodycm = 5526612;
bodyc1 = 12829635;
bodyc3 = 1513239;
}
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/0A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodycm);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/1A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc1);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/2A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc2);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/3A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc3);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/4A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
} else {
if (saiOozar) {
bdyskn = new ResourceLocation("jinryuudragonbc:cc/oozaru1.png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(skintype != 0 ? bodycm : 11374471);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
tailCol = race != 2 && bodytype == 0 ? 6498048 : bodytype;
jx = State != 0 && State != 7 ? (lg ? 10092390 : 16574610) : (skintype == 1 ? bodyc1 : tailCol);
bdyskn = new ResourceLocation("jinryuudragonbc:cc/oozaru2.png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(jx);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
} else if (skintype != 0) {
bdyskn = new ResourceLocation("jinryuumodscore:cc/" + (gen == 1 ? "f" : "") + "hum.png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodycm);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
if (!saiOozar) {
if (skintype == 0) {
bdyskn = acp.getLocationSkin().equals(ClientEventHandler.steveTextures) ? (gen >= 1 ? ClientEventHandler.fem : ClientEventHandler.steveTextures) : acp.getLocationSkin();
if (jhdsBool && (boolean) JBRAH.getMethod("getSkinHas", Object.class).invoke(null, data)) {
mc.getTextureManager().bindTexture((ResourceLocation) JBRAH.getMethod("getSkinLoc", Object.class).invoke(null, data));
} else {
mc.getTextureManager().bindTexture(bdyskn);
}
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
} else if (jhdsBool && (boolean) JBRAH.getMethod("getSkinHas", Object.class).invoke(null, data) && skintype == 0) {
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
mc.getTextureManager().bindTexture((ResourceLocation) JBRAH.getMethod("getSkinLoc", Object.class).invoke(null, data));
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
if (State == 14) {
tailCol = race != 2 && bodytype == 0 ? 6498048 : bodytype;
tailCol = (boolean)JRMCoreH.getMethod("isAprilFoolsModeOn").invoke(null) ? 13292516 : tailCol;
tailCol = skintype == 1 ? bodyc1 : tailCol;
if ((boolean) JRMCoreH.getMethod("rSai", int.class).invoke(null, race) && tailCol == 6498048 && State == 14) {
if ((boolean)JRMCoreH.getMethod("isAprilFoolsModeOn").invoke(null)) {
tailCol = 13292516;
} else {
tailCol = 14292268;
}
}
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuudragonbc:cc/ss4" + (skintype == 0 ? "a" : "b") + ".png"));
glColor3f(tailCol);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
}
}
if ((boolean) JGConfigClientSettings.getField("CLIENT_DA19").get(null) && (dbcBool || (boolean) JRMCoreH.getMethod("NC").invoke(null))) {
GL11.glPushMatrix();
GL11.glEnable(3042);
GL11.glDisable(2896);
GL11.glBlendFunc(770, 771);
GL11.glAlphaFunc(516, 0.003921569F);
GL11.glDepthMask(false);
tailCol = Integer.parseInt((String) JRMCoreH.getMethod("data", String.class, int.class, String.class
).invoke(null, par1EntityPlayer.getCommandSenderName(), 8, "200"));
float one = (float)tailCol / 100.0F;
j = (int)((float)tailCol / one);
if (j < 70) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuumodscore:cc/bruises1.png"));
this.renderLimbs();
}
if (j < 55) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuumodscore:cc/bruises2.png"));
this.renderLimbs();
}
if (j < 35) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuumodscore:cc/bruises3.png"));
this.renderLimbs();
}
if (j < 20) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuumodscore:cc/bruises4.png"));
this.renderLimbs();
}
GL11.glDepthMask(true);
GL11.glEnable(2896);
GL11.glDisable(3042);
GL11.glPopMatrix();
}
ItemStack itemstack = par1EntityPlayer.inventory.armorItemInSlot(2);
String dbcarmor;
Item item;
ResourceLocation mcarmor;
ResourceLocation armor;
ItemArmor itemarmor;
if (itemstack != null) {
item = itemstack.getItem();
if (item instanceof ItemArmor) {
itemarmor = (ItemArmor)item;
GL11.glPushMatrix();
dbcarmor = itemarmor.getArmorTexture(itemstack, par1EntityPlayer, 2, null);
mcarmor = RenderBiped.getArmorResource(par1EntityPlayer, itemstack, 1, null);
if (dbcarmor != null) {
dbcarmor = dbcarmor.replace("jbra", "").replace("_dam", "");
}
armor = dbcarmor != null ? new ResourceLocation(dbcarmor) : mcarmor;
mc.getTextureManager().bindTexture(armor);
GL11.glPushMatrix();
if (id > -1) {
RenderPlayerJBRA.getMethod("func_aam", int.class, boolean.class, boolean.class).invoke(renderPlayer, id, false, true);
}
GL11.glColor3f(1.0F + getR(), 1.0F + getG(), 1.0F + getB());
GL11.glScalef(1.0001F, 1.0001F, 1.0001F);
if (dbcarmor != null) {
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
modelMain.textureHeight = 64;
modelMain.textureWidth = 128;
this.renderLimbs();
} else {
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
if (race == 3 && dbcBool) {
bdyskn = new ResourceLocation("jinryuudragonbc:cc/nam/0nam" + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodycm);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/nam/1nam" + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc1);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/nam/2nam" + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc2);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/nam/3nam" + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
} else if (race == 4 && dbcBool) {
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/0A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodycm);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/1A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc1);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/2A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc2);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/3A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodyc3);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
bdyskn = new ResourceLocation("jinryuudragonbc:cc/arc/" + (gen == 1 ? "f" : "m") + "/4A" + ((short[]) JRMCoreH.getField("TransFrSkn").get(null))[State] + plyrSpc + ".png");
mc.getTextureManager().bindTexture(bdyskn);
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
} else {
if (saiOozar) {
bdyskn = new ResourceLocation("jinryuudragonbc:cc/oozaru1.png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(skintype != 0 ? bodycm : 11374471);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
jx = race != 2 && bodytype == 0 ? 6498048 : bodytype;
j = State != 0 && State != 7 ? (lg ? 10092390 : 16574610) : (skintype == 1 ? bodyc1 : jx);
bdyskn = new ResourceLocation("jinryuudragonbc:cc/oozaru2.png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(j);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
} else if (skintype != 0) {
bdyskn = new ResourceLocation("jinryuumodscore:cc/" + (gen == 1 ? "f" : "") + "hum.png");
mc.getTextureManager().bindTexture(bdyskn);
glColor3f(bodycm);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
if (!saiOozar) {
if (skintype == 0) {
bdyskn = acp.getLocationSkin().equals(ClientEventHandler.steveTextures) ? (gen >= 1 ? ClientEventHandler.fem : ClientEventHandler.steveTextures) : acp.getLocationSkin();
if (jhdsBool && (boolean) JBRAH.getMethod("getSkinHas", Object.class).invoke(null, data)) {
mc.getTextureManager().bindTexture((ResourceLocation) JBRAH.getMethod("getSkinLoc", Object.class).invoke(null, data));
} else {
mc.getTextureManager().bindTexture(bdyskn);
}
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
} else if (jhdsBool && (boolean) JBRAH.getMethod("getSkinHas", Object.class).invoke(null, data) && skintype == 0) {
GL11.glColor3f(h1 + getR(), h1 + getG(), h1 + getB());
mc.getTextureManager().bindTexture((ResourceLocation) JBRAH.getMethod("getSkinLoc", Object.class).invoke(null, data));
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
if (State == 14) {
tailCol = race != 2 && bodytype == 0 ? 6498048 : bodytype;
tailCol = (boolean)JRMCoreH.getMethod("isAprilFoolsModeOn").invoke(null) ? 13292516 : tailCol;
jx = skintype == 1 ? bodyc1 : tailCol;
if ((boolean) JRMCoreH.getMethod("rSai", int.class).invoke(null, race) && jx == 6498048 && State == 14) {
if ((boolean)JRMCoreH.getMethod("isAprilFoolsModeOn").invoke(null)) {
jx = 13292516;
} else {
jx = 14292268;
}
}
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuudragonbc:cc/ss4" + (skintype == 0 ? "a" : "b") + ".png"));
glColor3f(jx);
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
}
}
if ((boolean) JGConfigClientSettings.getField("CLIENT_DA19").get(null)) {
GL11.glPushMatrix();
GL11.glEnable(3042);
GL11.glDisable(2896);
GL11.glBlendFunc(770, 771);
GL11.glAlphaFunc(516, 0.003921569F);
GL11.glDepthMask(false);
tailCol = (int) JRMCoreH.getMethod(
"stat", Entity.class, int.class, int.class, int.class, int.class, int.class, int.class, float.class).invoke(null,
par1EntityPlayer, 2,
(byte) JRMCoreH.getField("Pwrtyp").get(null), 2,
((int[]) JRMCoreH.getField("PlyrAttrbts").get(null))[2], race,
(byte) JRMCoreH.getField("Class").get(null), 0.0F);
jx = Integer.parseInt((String) JRMCoreH.getMethod("data", String.class, int.class, String.class).invoke(null, par1EntityPlayer.getCommandSenderName(), 8, "200"));
float one = (float)tailCol / 100.0F;
int perc = (int)((float)jx / one);
if (perc < 70) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuumodscore:cc/bruises1.png"));
this.renderLimbs();
}
if (perc < 55) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuumodscore:cc/bruises2.png"));
this.renderLimbs();
}
if (perc < 35) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuumodscore:cc/bruises3.png"));
this.renderLimbs();
}
if (perc < 20) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(new ResourceLocation("jinryuumodscore:cc/bruises4.png"));
this.renderLimbs();
}
GL11.glDepthMask(true);
GL11.glEnable(2896);
GL11.glDisable(3042);
GL11.glPopMatrix();
}
if (itemstack != null) {
item = itemstack.getItem();
if (item instanceof ItemArmor) {
itemarmor = (ItemArmor)item;
GL11.glPushMatrix();
dbcarmor = itemarmor.getArmorTexture(itemstack, par1EntityPlayer, 2, null);
mcarmor = RenderBiped.getArmorResource(par1EntityPlayer, itemstack, 1, null);
if (dbcarmor != null) {
dbcarmor = dbcarmor.replace("jbra", "").replace("_dam", "");
}
armor = dbcarmor != null ? new ResourceLocation(dbcarmor) : mcarmor;
mc.getTextureManager().bindTexture(armor);
if (id == 0 || id == 3 || id == 5) {
if (id == 0) {
if ((boolean) JGConfigClientSettings.getField("CLIENT_DA18").get(null)) {
GL11.glPushMatrix();
RenderPlayerJBRA.getMethod("func_aam", int.class, boolean.class, boolean.class).invoke(renderPlayer, id, false, true);
GL11.glColor3f(1.0F + getR(), 1.0F + getG(), 1.0F + getB());
GL11.glScalef(1.0001F, 1.0001F, 1.0001F);
if (dbcarmor != null) {
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
modelMain.textureHeight = 64;
modelMain.textureWidth = 128;
this.renderLimbs();
} else {
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
GL11.glPopMatrix();
}
} else {
GL11.glPushMatrix();
RenderPlayerJBRA.getMethod("func_aam", int.class, boolean.class, boolean.class).invoke(renderPlayer, id, false, true);
GL11.glColor3f(1.0F + getR(), 1.0F + getG(), 1.0F + getB());
GL11.glScalef(1.0001F, 1.0001F, 1.0001F);
if (dbcarmor != null) {
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
modelMain.textureHeight = 64;
modelMain.textureWidth = 128;
this.renderLimbs();
} else {
modelMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
this.renderLimbs();
}
GL11.glPopMatrix();
}
}
GL11.glPopMatrix();
}
}
}
GL11.glPopMatrix();
}
private float getR() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Class<?> RenderPlayerJBRA = Class.forName("JinRyuu.JBRA.RenderPlayerJBRA");
Method method = RenderPlayerJBRA.getDeclaredMethod("getR");
method.setAccessible(true);
return (float) method.invoke(null);
}
private float getB() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Class<?> RenderPlayerJBRA = Class.forName("JinRyuu.JBRA.RenderPlayerJBRA");
Method method = RenderPlayerJBRA.getDeclaredMethod("getB");
method.setAccessible(true);
return (float) method.invoke(null);
}
private float getG() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Class<?> RenderPlayerJBRA = Class.forName("JinRyuu.JBRA.RenderPlayerJBRA");
Method method = RenderPlayerJBRA.getDeclaredMethod("getG");
method.setAccessible(true);
return (float) method.invoke(null);
}
private void glColor3f(int c) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, IllegalAccessException {
float h2 = (float)(c >> 16 & 255) / 255.0F;
float h3 = (float)(c >> 8 & 255) / 255.0F;
float h4 = (float)(c & 255) / 255.0F;
float h1 = 1.0F;
float r = h1 * h2;
float g = h1 * h3;
float b = h1 * h4;
GL11.glColor3f(r + getR(), g + getG(), b + getB());
}
@Shadow private RenderBlocks renderBlocksIr;
@Shadow private static ResourceLocation RES_ITEM_GLINT;
@@ -271,6 +271,9 @@ public abstract class MixinModelRenderer {
try {
Class<?> ModelBipedBody = Class.forName("JinRyuu.JRMCore.entity.ModelBipedBody");
Object model = renderer.baseModel;
if(!(model instanceof ModelBiped))
return null;
Field[] declared;
if (ClientEventHandler.declaredFieldCache.containsKey(ModelBipedBody)) {
declared = ClientEventHandler.declaredFieldCache.get(ModelBipedBody);
@@ -14,10 +14,8 @@ import net.minecraft.nbt.NBTTagString;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.BlockSnapshot;
@@ -1373,4 +1371,9 @@ public class ScriptWorld implements IWorld {
public String toString() {
return "DIM" + this.getDimensionID();
}
@Override
public void broadcast(String message){
world.func_73046_m().getConfigurationManager().sendChatMsg(new ChatComponentText(message));
}
}
@@ -1319,7 +1319,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
return;
this.npc.display.url = url;
npc.textureLocation = null;
npc.display.skinType = 2;
if(npc.display.skinType < 2)
npc.display.skinType = 2;
npc.script.clientNeedsUpdate = true;
}
@@ -464,34 +464,29 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
* @param amount How many will be removed
* @return Returns true if the items were removed succesfully. Returns false incase a bigger amount than what the player has was given
*/
public boolean removeItem(IItemStack item, int amount, boolean ignoreNBT, boolean ignoreDamage) {
int count = inventoryItemCount(item);
if(amount > count)
return false;
else if(count == amount)
removeAllItems(item);
else{
for(int i = 0; i < player.inventory.mainInventory.length; i++){
ItemStack is = player.inventory.mainInventory[i];
if (is != null && NoppesUtilPlayer.compareItems(is, item.getMCItemStack(), ignoreDamage, ignoreNBT)) {
if(amount > is.stackSize){
player.inventory.mainInventory[i] = null;
amount -= is.stackSize;
}
else{
is.splitStack(amount);
break;
}
}
}
}
this.updatePlayerInventory();
return true;
}
public void removeAllItems(IItemStack item){
removeAllItems(item, true, true);
}
public boolean removeItem(IItemStack item, int amount, boolean ignoreNBT, boolean ignoreDamage) {
int count = inventoryItemCount(item,ignoreNBT,ignoreDamage);
if(amount > count) {
return false;
} else if(count == amount) {
removeAllItems(item, ignoreNBT, ignoreDamage);
} else {
for(int i = 0; i < player.inventory.mainInventory.length; i++) {
ItemStack is = player.inventory.mainInventory[i];
if (is != null && NoppesUtilPlayer.compareItems(is, item.getMCItemStack(), ignoreDamage, ignoreNBT)) {
if(amount > is.stackSize){
player.inventory.mainInventory[i] = null;
amount -= is.stackSize;
} else{
is.splitStack(amount);
break;
}
}
}
}
this.updatePlayerInventory();
return true;
}
/**
* @param item The item to be removed from the players inventory
@@ -156,7 +156,7 @@ public abstract class ItemEvent extends CustomNPCsEvent implements IItemEvent {
}
public String getHookName() {
return EnumScriptType.INTERACT.function;
return EnumScriptType.RIGHT_CLICK.function;
}
public int getType() {
@@ -227,7 +227,7 @@ public abstract class NpcEvent extends CustomNPCsEvent implements INpcEvent {
public SwingEvent(ICustomNpc npc, ItemStack itemStack) {
super(npc);
this.itemStack = (IItemStack)NpcAPI.Instance().getIItemStack(itemStack);
this.itemStack = itemStack == null ? null : (IItemStack)NpcAPI.Instance().getIItemStack(itemStack);
}
public String getHookName() {
@@ -237,7 +237,6 @@ public abstract class NpcEvent extends CustomNPCsEvent implements INpcEvent {
/**
* @return Returns the swung item
*/
@Override
public IItemStack getItemStack() {
return itemStack;
}
@@ -30,6 +30,7 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
public int maxItemUseDuration = 20;
public int itemUseAction = 0; //0: none, 1: block, 2: bow, 3: eat, 4: drink
public boolean isNormalItem = false;
public boolean isTool = false;
public int digSpeed = 1;
public int armorType = -2; //-2: Fits in no armor slot, -1: Fits in all slots, 0 - 4: Fits in Head -> Boots slot respectively
@@ -109,8 +110,8 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
return this.enabled;
}
public void setEnabled(boolean bo) {
this.enabled = bo;
public void setEnabled(boolean enable) {
this.enabled = enable;
}
public String getLanguage() {
@@ -173,6 +174,16 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
return this.isTool;
}
public void setIsNormalItem(boolean normalItem){
this.isNormalItem = normalItem;
saveItemData();
}
public boolean isNormalItem(){
return this.isNormalItem;
}
public void setDigSpeed(int digSpeed){
this.digSpeed = digSpeed;
saveItemData();
@@ -367,6 +378,7 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
compound.setFloat("TranslateZ",this.translateZ);
compound.setBoolean("IsTool", this.isTool);
compound.setBoolean("IsNormalItem", this.isNormalItem);
compound.setInteger("DigSpeed", this.digSpeed);
compound.setInteger("ArmorType", this.armorType);
compound.setInteger("Enchantability", this.enchantability);
@@ -403,6 +415,7 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
this.translateZ = compound.getFloat("TranslateZ");
this.isTool = compound.getBoolean("IsTool");
this.isNormalItem = compound.getBoolean("IsNormalItem");
this.digSpeed = compound.getInteger("DigSpeed");
this.armorType = compound.getInteger("ArmorType");
this.enchantability = compound.getInteger("Enchantability");
@@ -6,18 +6,17 @@ import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTBase.NBTPrimitive;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraftforge.common.IPlantable;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.api.INbt;
import noppes.npcs.api.item.IItemStack;
import noppes.npcs.items.ItemScripted;
import noppes.npcs.scripted.CustomNPCsException;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.ScriptNbt;
@@ -48,35 +47,35 @@ public class ScriptItemStack implements IItemStack {
public String getName(){
return Item.itemRegistry.getNameForObject(item.getItem());
}
/**
* @return Returns the stacksize
*/
public int getStackSize(){
return item.stackSize;
}
/**
* @return Return whether or not the item has a custom name
*/
public boolean hasCustomName(){
return item.hasDisplayName();
}
/**
* @param name The custom name this item will get
*/
public void setCustomName(String name){
item.setStackDisplayName(name);
}
/**
* @return Return the ingame displayed name. This is either the item name or the custom name if it has one.
*/
public String getDisplayName(){
return item.getDisplayName();
}
/**
* @return Get the items ingame name. Use this incase the item ingame has custom name and you want the original name.
*/
@@ -99,21 +98,21 @@ public class ScriptItemStack implements IItemStack {
size = 64;
item.stackSize = size;
}
/**
* @return Returns the item damage of this item. For tools this is the durability for other items the color and more.
*/
public int getItemDamage(){
return item.getItemDamage();
}
/**
* @param value The value to be set as item damage. For tools this is the durability for other items the color and more.
*/
public void setItemDamage(int value){
item.setItemDamage(value);
}
/**
* @param key The key of this NBTTag
* @param value The value to be stored. Can be a Number or String
@@ -123,9 +122,9 @@ public class ScriptItemStack implements IItemStack {
getTag().setDouble(key, ((Number) value).doubleValue());
else if(value instanceof String)
getTag().setString(key, (String) value);
}
/**
* @param key The key of the NBTTag
* @return Returns whether or not the key exists
@@ -135,7 +134,7 @@ public class ScriptItemStack implements IItemStack {
return false;
return getTag().hasKey(key);
}
/**
* @param key The key of the NBTTag
* @return Returns the value associated with the key. Returns null of it doesnt exist
@@ -159,11 +158,11 @@ public class ScriptItemStack implements IItemStack {
item.stackTagCompound = null;
return nbt;
}
public boolean isEnchanted(){
return item.isItemEnchanted();
}
/**
* @since 1.7.10d
* @param id The enchantment id
@@ -278,19 +277,18 @@ public class ScriptItemStack implements IItemStack {
this.item.setTagCompound(compound = new NBTTagCompound());
}
NBTTagList nbttaglist = compound.getTagList("display", 10);
NBTTagList newList = new NBTTagList();
String[] var4 = lore;
int var5 = lore.length;
NBTTagCompound display = compound.getCompoundTag("display");
if(lore == null || lore.length == 0) {
display.removeTag("Lore");
return;
}
for(int var6 = 0; var6 < var5; ++var6) {
String s = var4[var6];
newList.appendTag(new NBTTagString(s));
}
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setTag("Lore", newList);
compound.setTag("display", nbttagcompound);
NBTTagList nbtlist = new NBTTagList();
for(String s : lore) {
nbtlist.appendTag(new NBTTagString(s));
}
display.setTag("Lore", nbtlist);
compound.setTag("display", display);
}
public boolean hasAttribute(String name) {
@@ -310,7 +308,34 @@ public class ScriptItemStack implements IItemStack {
return false;
}
}
private static ScriptItemStack createNew(ItemStack item){
if(item == null)
return null;
if(item.getItem() instanceof ItemScripted) {
return new ScriptCustomItem(item);
}
if(item.getItem() == Items.written_book || item.getItem() == Items.writable_book || item.getItem() instanceof ItemWritableBook || item.getItem() instanceof ItemEditableBook)
return new ScriptItemBook(item);
if(item.getItem() instanceof ItemArmor)
return new ScriptItemArmor(item);
if (item.getItem() instanceof ItemBlock)
return new ScriptItemBlock(item);
return new ScriptItemStack(item);
}
@Override
public IItemStack copy() {
return createNew(item.copy());
}
@Override
public int getMaxItemDamage(){
return item.getMaxDamage();
}
/**
* @since 1.7.10d
* @return Returns whether this item is a book
@@ -318,7 +343,7 @@ public class ScriptItemStack implements IItemStack {
public boolean isWrittenBook(){
return item.getItem() == Items.written_book || item.getItem() == Items.writable_book;
}
/**
* @since 1.7.10d
* @return Returns the books title
@@ -334,28 +359,28 @@ public class ScriptItemStack implements IItemStack {
public String getBookAuthor(){
return item.getTagCompound().getString("author");
}
/**
* @since 1.7.10d
* @return If the item is a book, returns a string array with book pages
*/
public String[] getBookText(){
public String[] getBookText(){
if(!isWrittenBook())
return null;
List<String> list = new ArrayList<String>();
NBTTagList pages = item.getTagCompound().getTagList("pages", 8);
for (int i = 0; i < pages.tagCount(); ++i){
list.add(pages.getStringTagAt(i));
}
list.add(pages.getStringTagAt(i));
}
return list.toArray(new String[list.size()]);
}
private NBTTagCompound getTag(){
if(item.stackTagCompound == null)
item.stackTagCompound = new NBTTagCompound();
return item.stackTagCompound;
}
/**
* @return Returns whether or not this item is a block
*/
@@ -365,11 +390,11 @@ public class ScriptItemStack implements IItemStack {
return false;
return true;
}
public boolean isFood() {
return item.getItem() instanceof ItemFood;
}
public int getFoodPoints() {
if (isFood()) return ((ItemFood)item.getItem()).func_150905_g(item);
return -1;
@@ -413,4 +438,14 @@ public class ScriptItemStack implements IItemStack {
public boolean equals(Object object) {
return object instanceof ScriptItemStack && ((ScriptItemStack) object).getMCItemStack().equals(this.getMCItemStack());
}
@Override
public boolean compare(IItemStack item, boolean ignoreNBT) {
return NoppesUtilPlayer.compareItems(getMCItemStack(), item.getMCItemStack(), false, ignoreNBT);
}
@Override
public boolean compare(IItemStack item, boolean ignoreDamage, boolean ignoreNBT) {
return NoppesUtilPlayer.compareItems(getMCItemStack(), item.getMCItemStack(), ignoreDamage, ignoreNBT);
}
}