Merge branch 'dev'

This commit is contained in:
Kam committed 2024-04-09 03:17:06 -04:00
commit f67e1ef808
74 files changed
+1595 -397

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ plugins {
id 'idea'
}
version = "1.9.1"
version = "1.9.2"
group= "kamkeel.customnpc-plus"
archivesBaseName = "CustomNPC-Plus"
+1 -1
View File
@@ -8,7 +8,7 @@ modId = customnpcs
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = noppes.npcs
modVersion = 1.9.1
modVersion = 1.9.2
gtnh.modules.codeStyle=true
gtnh.modules.gitVersion=false
+1 -1
Submodule src/api updated: 6e496fed5d...7489396198.
@@ -1,5 +1,6 @@
package kamkeel.addon;
import kamkeel.addon.client.DBCClient;
import kamkeel.addon.client.GeckoAddonClient;
public class AddonManager {
@@ -17,5 +18,9 @@ public class AddonManager {
// Gecko Addon Initialization
new GeckoAddon();
new GeckoAddonClient();
// DBC Addon
new DBCAddon();
new DBCClient();
}
}
+27
View File
@@ -0,0 +1,27 @@
package kamkeel.addon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import noppes.npcs.entity.EntityNPCInterface;
public class DBCAddon {
public static DBCAddon instance;
public boolean supportEnabled = true;
/**
* This class is a shell class to be changed via mixins
* The Addon Mod will replace all blank functions within
* this class to change the ongoing code.
*/
public DBCAddon(){
instance = this;
}
public void dbcCopyData(EntityLivingBase copied, EntityLivingBase entity){}
public boolean canDBCAttack(EntityNPCInterface npc, float attackStrength, Entity receiver){
return false;
}
public void doDBCDamage(EntityNPCInterface npc, float attackStrength, Entity receiver){}
}
@@ -0,0 +1,33 @@
package kamkeel.addon.client;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.EntityLivingBase;
import noppes.npcs.client.gui.mainmenu.GuiNpcStats;
import noppes.npcs.client.gui.model.GuiCreationScreen;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.model.ModelMPM;
import noppes.npcs.entity.EntityNPCInterface;
public class DBCClient {
public static DBCClient Instance;
public boolean supportEnabled = true;
/**
* This class is a shell class to be changed via mixins
* The Addon Mod will replace all blank functions within
* this class to change the ongoing code.
* The fewer classes modified by mixins the safer.
* These are for mixins affecting only client-side classes.
*/
public DBCClient(){
Instance = this;
}
// Stat Buttons
public void showDBCStatButtons(GuiNpcStats stats, EntityLivingBase entity){}
public void showDBCStatActionPerformed(GuiNpcStats stats, GuiNpcButton btn){}
// Render Auras
public void renderDBCAuras(EntityNPCInterface npcInterface){}
}
@@ -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.1")
@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.9.2")
public class CustomNpcs {
@SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy")
+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
@@ -578,11 +578,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());
}
@@ -466,8 +466,11 @@ public class PacketHandlerServer{
if(type == EnumPacketServer.ScriptPlayerGet) {
getScripts(data,buffer,player);
} else if(type == EnumPacketServer.ScriptPlayerSave) {
int tab = buffer.getInt(buffer.readerIndex());
saveScripts(data,buffer,player);
ScriptController.Instance.lastPlayerUpdate = System.currentTimeMillis();
if(tab == -1)
ScriptController.Instance.savePlayerScriptsSync();
}
}
@@ -476,8 +479,11 @@ public class PacketHandlerServer{
if (type == EnumPacketServer.ScriptForgeGet) {
getScripts(data,buffer,player);
} else if (type == EnumPacketServer.ScriptForgeSave) {
int tab = buffer.getInt(buffer.readerIndex());
saveScripts(data,buffer,player);
ScriptController.Instance.lastForgeUpdate = System.currentTimeMillis();
if(tab == -1)
ScriptController.Instance.saveForgeScriptsSync();
}
}
@@ -486,8 +492,11 @@ public class PacketHandlerServer{
if(type == EnumPacketServer.ScriptGlobalNPCGet) {
getScripts(data,buffer,player);
} else if(type == EnumPacketServer.ScriptGlobalNPCSave) {
int tab = buffer.getInt(buffer.readerIndex());
saveScripts(data,buffer,player);
ScriptController.Instance.lastGlobalNpcUpdate = System.currentTimeMillis();
if(tab == -1)
ScriptController.Instance.saveGlobalScriptsSync();
}
}
@@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
import net.minecraftforge.event.entity.item.ItemTossEvent;
@@ -23,10 +24,12 @@ import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.constants.EnumQuestType;
import noppes.npcs.constants.SyncType;
import noppes.npcs.controllers.PartyController;
import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.*;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.quests.QuestItem;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.item.ScriptCustomItem;
@@ -61,8 +64,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;
}
@@ -237,6 +239,21 @@ public class ScriptPlayerEventHandler {
if(event.player == null || event.player.worldObj == null)
return;
if(!event.player.worldObj.isRemote && !(event.player instanceof FakePlayer)){
PlayerData playerData = PlayerDataController.Instance.getPlayerData(event.player);
PlayerQuestData questData = playerData.questData;
QuestItem.pickedUp = event.pickedUp.getEntityItem();
Party playerParty = playerData.getPlayerParty();
if(playerParty != null){
QuestItem.pickedUpParty = event.pickedUp.getEntityItem();
QuestItem.pickedUpPlayer = event.player;
PartyController.Instance().checkQuestCompletion(playerParty, EnumQuestType.Item);
}
questData.checkQuestCompletion(playerData, EnumQuestType.Item);
}
if(event.player.worldObj instanceof WorldServer) {
PlayerDataScript handler = ScriptController.Instance.playerScripts;
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.player);
@@ -411,7 +428,7 @@ public class ScriptPlayerEventHandler {
} catch (Exception ignored) {}
}
if(source instanceof EntityPlayer) {
if(event.source.getEntity() instanceof EntityPlayer) {
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.source.getEntity());
EventHooks.onPlayerKills(handler,scriptPlayer, event.entityLiving);
}
@@ -432,7 +449,7 @@ public class ScriptPlayerEventHandler {
event.setCanceled(EventHooks.onPlayerAttacked(handler, pevent));
}
if(source instanceof EntityPlayer) {
if(event.source.getEntity() instanceof EntityPlayer) {
noppes.npcs.scripted.event.PlayerEvent.AttackEvent pevent1 = new noppes.npcs.scripted.event.PlayerEvent.AttackEvent((IPlayer)NpcAPI.Instance().getIEntity((EntityPlayer)event.source.getEntity()), event.entityLiving, event.ammount, event.source);
event.setCanceled(EventHooks.onPlayerAttack(handler, pevent1));
}
@@ -454,7 +471,7 @@ public class ScriptPlayerEventHandler {
}
if(source instanceof EntityPlayer) {
noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent pevent1 = new noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent((IPlayer)NpcAPI.Instance().getIEntity((EntityPlayer)event.source.getEntity()), event.entityLiving, event.ammount, event.source);
noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent pevent1 = new noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent((IPlayer)NpcAPI.Instance().getIEntity(source), event.entityLiving, event.ammount, event.source);
event.setCanceled(EventHooks.onPlayerDamagedEntity(handler, pevent1));
event.ammount = pevent1.damage;
}
+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);
}
@@ -457,25 +457,7 @@ public class ServerEventsHandler {
PartyController.Instance().pingPartyQuestObjectiveUpdate(party);
PartyController.Instance().checkQuestCompletion(party, EnumQuestType.Kill);
}
@SubscribeEvent
public void pickUp(EntityItemPickupEvent event){
if(event.entityPlayer.worldObj.isRemote || event.entityPlayer instanceof FakePlayer)
return;
PlayerData playerData = PlayerDataController.Instance.getPlayerData(event.entityPlayer);
PlayerQuestData questData = playerData.questData;
QuestItem.pickedUp = event.item.getEntityItem();
Party playerParty = playerData.getPlayerParty();
if(playerParty != null){
QuestItem.pickedUpParty = event.item.getEntityItem();
QuestItem.pickedUpPlayer = event.entityPlayer;
PartyController.Instance().checkQuestCompletion(playerParty, EnumQuestType.Item);
}
questData.checkQuestCompletion(playerData, EnumQuestType.Item);
}
@SubscribeEvent
public void world(PlayerEvent.SaveToFile event){
PlayerData data = PlayerDataController.Instance.getPlayerData((EntityPlayer) event.entity);
@@ -7,6 +7,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -24,6 +25,8 @@ import noppes.npcs.constants.EnumGuiType;
import java.util.Random;
public class BlockScripted extends BlockContainer {
public int renderId = -1;
public static final AxisAlignedBB AABB = AxisAlignedBB.getBoundingBox(0.001f, 0.001f, 0.001f, 0.998f, 0.998f, 0.998f);
public static final AxisAlignedBB AABB_EMPTY = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
@@ -40,7 +43,7 @@ public class BlockScripted extends BlockContainer {
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
TileScripted tile = (TileScripted) world.getTileEntity(x, y, z);
if (tile != null && tile.isPassible)
if (tile != null && tile.isPassible && (tile.blockModel == null || tile.blockModel == Blocks.air))
return AABB_EMPTY;
return AABB.getOffsetBoundingBox(x,y,z);
}
@@ -53,6 +56,13 @@ public class BlockScripted extends BlockContainer {
return AABB.getOffsetBoundingBox(x,y,z);
}
@Override
public boolean getBlocksMovement(IBlockAccess worldIn, int x, int y, int z)
{
TileScripted tile = (TileScripted) worldIn.getTileEntity(x, y, z);
return tile != null && tile.isPassible;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote)
@@ -101,12 +111,12 @@ public class BlockScripted extends BlockContainer {
@Override
public boolean canRenderInPass(int pass) {
return false;
return super.canRenderInPass(pass);
}
@Override
public int getRenderType() {
return 0;
return renderId;
}
@Override
public boolean isOpaqueCube() {
@@ -15,9 +15,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import noppes.npcs.*;
import noppes.npcs.api.IBlock;
import noppes.npcs.api.block.ITextPlane;
import noppes.npcs.client.renderer.blocks.BlockScriptedRenderer;
import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.controllers.ScriptController;
@@ -48,6 +50,8 @@ public class TileScripted extends TileEntity implements IScriptBlockHandler {
public ItemStack itemModel = new ItemStack(CustomItems.scripted);
public Block blockModel = null;
private boolean hideModel;
private int metadata;
public boolean needsClientUpdate = false;
@@ -68,6 +72,7 @@ public class TileScripted extends TileEntity implements IScriptBlockHandler {
public TileEntity renderTile;
public boolean renderTileErrored = true;
public boolean renderFullBlock = true;
public ITickable renderTileUpdate = null;
public TextPlane text1 = new TextPlane();
@@ -133,14 +138,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
@@ -215,12 +224,32 @@ public class TileScripted extends TileEntity implements IScriptBlockHandler {
EventHooks.onScriptBlockUpdate(this);
ticksExisted = 0;
if(needsClientUpdate){
markDirty();
worldObj.func_147451_t(xCoord, yCoord, zCoord);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.notifyBlocksOfNeighborChange(xCoord,yCoord,zCoord,getBlockType(),3);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, CustomItems.scripted);
Chunk chunk = worldObj.getChunkFromChunkCoords(xCoord >> 4, zCoord >> 4);
chunk.setBlockMetadata(xCoord & 15, yCoord, zCoord & 15, metadata);
blockMetadata = metadata;
needsClientUpdate = false;
}
}
if (worldObj.isRemote) {
boolean markForUpdate = false;
boolean prevHideModel = this.hideModel;
boolean hideModel = BlockScriptedRenderer.overrideModel();
if (hideModel != prevHideModel) {
this.hideModel = hideModel;
markForUpdate = true;
}
if (markForUpdate) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
@Override
@@ -228,11 +257,22 @@ public class TileScripted extends TileEntity implements IScriptBlockHandler {
handleUpdateTag(pkt.func_148857_g());
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldRenderInPass(int arg0) {
if (blockModel != null && blockModel.isOpaqueCube()
&& !BlockScriptedRenderer.overrideModel()) {
return true;
}
return super.shouldRenderInPass(arg0);
}
public void handleUpdateTag(NBTTagCompound tag){
int light = lightValue;
setDisplayNBT(tag);
if(light != lightValue)
checkLight(worldObj,xCoord,yCoord,zCoord);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public boolean checkLight(World world, int x, int y, int z)
@@ -269,6 +309,9 @@ public class TileScripted extends TileEntity implements IScriptBlockHandler {
if(NoppesUtilPlayer.compareItems(item, itemModel, false, false) && b != blockModel)
return;
metadata = item.getItemDamage();
blockMetadata = metadata;
itemModel = item;
blockModel = b;
needsClientUpdate = true;
@@ -404,6 +447,11 @@ public class TileScripted extends TileEntity implements IScriptBlockHandler {
return this.customTileData;
}
@Override
public void markDirty() {
super.markDirty();
}
public class TextPlane implements ITextPlane {
public boolean textHasChanged = true;
public TextBlock textBlock;
@@ -494,7 +542,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;
}
@@ -1,18 +1,19 @@
package noppes.npcs.client;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
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.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.*;
import net.minecraftforge.event.entity.living.LivingEvent;
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
import noppes.npcs.client.renderer.MarkRenderer;
@@ -28,10 +29,15 @@ import java.util.HashMap;
import java.util.Map;
public class ClientEventHandler {
public static final RenderCNPCPlayer renderCNPCSelf = new RenderCNPCPlayer();
public static final RenderCNPCPlayer renderCNPCPlayer = new RenderCNPCPlayer();
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;
@@ -157,6 +163,12 @@ public class ClientEventHandler {
ClientEventHandler.renderingPlayer = event.entityPlayer;
}
@SubscribeEvent(priority= EventPriority.LOWEST)
public void pre(RenderPlayerEvent.Pre event){
if(!(event.entity instanceof AbstractClientPlayer))
return;
}
@SubscribeEvent
public void onRenderPlayer(RenderPlayerEvent.Post event) {
EntityPlayer player = event.entityPlayer;
@@ -170,6 +182,10 @@ public class ClientEventHandler {
} catch (ClassNotFoundException ignored) {}
if (!(event.renderer instanceof RenderCNPCPlayer)) {
renderCNPCPlayer.mainModel = event.renderer.mainModel;
renderCNPCPlayer.modelBipedMain = event.renderer.modelBipedMain;
renderCNPCPlayer.modelArmor = event.renderer.modelArmor;
renderCNPCPlayer.modelArmorChestplate = event.renderer.modelArmorChestplate;
renderCNPCPlayer.tempRenderPartialTicks = event.partialRenderTick;
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) event.partialRenderTick - RenderManager.renderPosX;
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) event.partialRenderTick - RenderManager.renderPosY;
@@ -210,6 +226,6 @@ public class ClientEventHandler {
}
public static boolean hasOverlays(EntityPlayer player) {
return ClientCacheHandler.skinOverlays.containsKey(player.getUniqueID()) && ClientCacheHandler.skinOverlays.get(player.getUniqueID()).values().size() > 0;
return ClientCacheHandler.skinOverlays.containsKey(player.getUniqueID()) && !ClientCacheHandler.skinOverlays.get(player.getUniqueID()).values().isEmpty();
}
}
@@ -27,10 +27,7 @@ import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import noppes.npcs.CommonProxy;
import noppes.npcs.CustomNpcs;
import noppes.npcs.LogWriter;
import noppes.npcs.PacketHandlerPlayer;
import noppes.npcs.*;
import noppes.npcs.api.IWorld;
import noppes.npcs.blocks.tiles.*;
import noppes.npcs.client.controllers.*;
@@ -53,7 +50,8 @@ import noppes.npcs.client.gui.script.GuiScriptItem;
import noppes.npcs.client.model.*;
import noppes.npcs.client.renderer.*;
import noppes.npcs.client.renderer.blocks.*;
import noppes.npcs.client.renderer.customitem.CustomItemRenderer;
import noppes.npcs.client.renderer.items.CustomItemRenderer;
import noppes.npcs.client.renderer.items.ScriptedBlockItemRenderer;
import noppes.npcs.config.ConfigClient;
import noppes.npcs.config.ConfigMain;
import noppes.npcs.config.StringCache;
@@ -103,6 +101,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileBlockAnvil.class, new BlockCarpentryBenchRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileMailbox.class, new BlockMailboxRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileScripted.class, new BlockScriptedRenderer());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(CustomItems.scripted), new ScriptedBlockItemRenderer());
RenderingRegistry.registerBlockHandler(new BlockBorderRenderer());
if(!ConfigMain.DisableExtraBlock){
@@ -1,5 +1,6 @@
package noppes.npcs.client;
import kamkeel.addon.DBCAddon;
import kamkeel.addon.GeckoAddon;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityDragon;
@@ -11,7 +12,7 @@ public class EntityUtil {
public static void Copy(EntityLivingBase copied, EntityLivingBase entity){
entity.worldObj = copied.worldObj;
entity.deathTime = copied.deathTime;
entity.distanceWalkedModified = copied.distanceWalkedModified;
entity.prevDistanceWalkedModified = copied.distanceWalkedModified;
@@ -20,18 +21,18 @@ public class EntityUtil {
entity.moveForward = copied.moveForward;
entity.moveStrafing = copied.moveStrafing;
entity.setPosition(copied.posX, copied.posY, copied.posZ);
entity.boundingBox.setBB(copied.boundingBox);
entity.prevPosX = copied.prevPosX;
entity.prevPosY = copied.prevPosY;
entity.prevPosZ = copied.prevPosZ;
entity.motionX = copied.motionX;
entity.motionY = copied.motionY;
entity.motionZ = copied.motionZ;
entity.rotationYaw = copied.rotationYaw;
entity.rotationPitch = copied.rotationPitch;
entity.prevRotationYaw = copied.prevRotationYaw;
@@ -41,9 +42,9 @@ public class EntityUtil {
entity.prevRenderYawOffset = copied.prevRenderYawOffset;
entity.cameraPitch = copied.cameraPitch;
entity.prevCameraPitch = copied.prevCameraPitch;
entity.renderYawOffset = copied.renderYawOffset;
entity.lastTickPosX = copied.lastTickPosX;
entity.lastTickPosY = copied.lastTickPosY;
entity.lastTickPosZ = copied.lastTickPosZ;
@@ -56,9 +57,9 @@ public class EntityUtil {
entity.prevSwingProgress = copied.prevSwingProgress;
entity.isSwingInProgress = copied.isSwingInProgress;
entity.swingProgressInt = copied.swingProgressInt;
entity.ticksExisted = copied.ticksExisted;
if(entity instanceof EntityPlayer && copied instanceof EntityPlayer){
EntityPlayer ePlayer = (EntityPlayer) entity;
EntityPlayer cPlayer = (EntityPlayer) copied;
@@ -73,19 +74,20 @@ public class EntityUtil {
ePlayer.field_71095_bQ = cPlayer.field_71095_bQ;
ePlayer.field_71085_bR = cPlayer.field_71085_bR;
}
if(entity instanceof EntityDragon){
entity.rotationYaw += 180;
}
if(entity instanceof EntityChicken){
((EntityChicken)entity).destPos = copied.onGround?0:1;
}
for(int i = 0; i < 5; i++){
entity.setCurrentItemOrArmor(i, copied.getEquipmentInSlot(i));
}
GeckoAddon.instance.geckoCopyData(copied, entity);
DBCAddon.instance.dbcCopyData(copied, entity);
if(copied instanceof EntityNPCInterface && entity instanceof EntityNPCInterface){
EntityNPCInterface npc = (EntityNPCInterface) copied;
@@ -94,9 +96,9 @@ public class EntityUtil {
target.textureLocation = npc.textureLocation;
target.display = npc.display;
target.inventory = npc.inventory;
target.currentAnimation = npc.currentAnimation;
target.setDataWatcher(npc.getDataWatcher());
}
}
@@ -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();
@@ -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"));
@@ -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();
}
}
@@ -136,6 +136,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());
}
}
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui.mainmenu;
import kamkeel.addon.DBCAddon;
import kamkeel.addon.client.DBCClient;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.nbt.NBTTagCompound;
@@ -70,6 +72,8 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
addLabel(new GuiNpcLabel(18,"stats.attackInvisible", guiLeft + 140, y + 5));
addLabel(new GuiNpcLabel(34,"stats.creaturetype", guiLeft + 275, y + 5));
addButton(new GuiNpcButton(8,guiLeft + 358, y, 56, 20, new String[]{"stats.normal","stats.undead","stats.arthropod"} ,stats.creatureType.ordinal()));
DBCClient.Instance.showDBCStatButtons(this, npc);
}
@Override
@@ -134,6 +138,10 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
else if (button.id == 22) {
stats.ignoreCobweb = (button.getValue() == 0);
}
// Button 300
if(guibutton instanceof GuiNpcButton)
DBCClient.Instance.showDBCStatActionPerformed(this, (GuiNpcButton) guibutton);
}
@Override
public void save() {
@@ -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);
}
@@ -388,16 +388,15 @@ public class ModelLegs extends ModelScaleRenderer{
}
}
TintData tintData = entity.display.tintData;
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor &&
!(tintData.isTintEnabled() && tintData.isGeneralTintEnabled());
if(bo){
boolean showColor = !base.isArmor && tintData.processColor(entity.hurtTime > 0 || entity.deathTime > 0);
if(showColor){
float red = (entity.modelData.legParts.color >> 16 & 255) / 255f;
float green = (entity.modelData.legParts.color >> 8 & 255) / 255f;
float blue = (entity.modelData.legParts.color & 255) / 255f;
GL11.glColor4f(red, green, blue, base.alpha);
}
super.render(par1);
if(bo){
if(showColor){
GL11.glColor4f(1, 1, 1, base.alpha);
}
GL11.glPopMatrix();
@@ -183,16 +183,15 @@ public class ModelTail extends ModelScaleRenderer {
}
}
TintData tintData = entity.display.tintData;
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor &&
!(tintData.isTintEnabled() && tintData.isGeneralTintEnabled());
if(bo){
boolean showColor = !base.isArmor && tintData.processColor(entity.hurtTime > 0 || entity.deathTime > 0);
if(showColor){
float red = (color >> 16 & 255) / 255f;
float green = (color >> 8 & 255) / 255f;
float blue = (color & 255) / 255f;
GL11.glColor4f(red, green, blue, base.alpha);
}
super.render(par1);
if(bo){
if(showColor){
GL11.glColor4f(1, 1, 1, base.alpha);
}
}
@@ -61,16 +61,15 @@ public abstract class ModelPartInterface extends ModelRenderer {
}
}
TintData tintData = entity.display.tintData;
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor &&
!(tintData.isTintEnabled() && tintData.isGeneralTintEnabled());
if(bo){
boolean showColor = !base.isArmor && tintData.processColor(entity.hurtTime > 0 || entity.deathTime > 0);
if(showColor){
float red = (color >> 16 & 255) / 255f;
float green = (color >> 8 & 255) / 255f;
float blue = (color & 255) / 255f;
GL11.glColor4f(red, green, blue, base.alpha);
}
super.render(par1);
if(bo){
if(showColor){
GL11.glColor4f(1, 1, 1, base.alpha);
}
}
@@ -6,11 +6,16 @@ import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import static noppes.npcs.client.ClientEventHandler.renderCNPCSelf;
public class RenderCNPCHand extends ItemRenderer {
/** A reference to the Minecraft object. */
private Minecraft mc;
@@ -45,8 +50,6 @@ public class RenderCNPCHand extends ItemRenderer {
GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
ItemStack itemstack = this.itemToRender;
RenderCNPCPlayer renderCNPCPlayer = new RenderCNPCPlayer();
int i = this.mc.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;
@@ -58,6 +61,8 @@ public class RenderCNPCHand extends ItemRenderer {
float f10;
float f13;
Render render;
RenderPlayer renderplayer;
if (itemstack == null && !entityclientplayermp.isInvisible())
{
@@ -84,7 +89,12 @@ public class RenderCNPCHand extends ItemRenderer {
f10 = 1.0F;
GL11.glScalef(f10, f10, f10);
renderCNPCPlayer.renderFirstPersonArmOverlay(this.mc.thePlayer);
render = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer);
renderplayer = (RenderPlayer) render;
renderCNPCSelf.modelBipedMain = renderplayer.modelBipedMain;
renderCNPCSelf.modelArmor = renderplayer.modelArmor;
renderCNPCSelf.modelArmorChestplate = renderplayer.modelArmorChestplate;
renderCNPCSelf.renderFirstPersonArmOverlay(this.mc.thePlayer);
GL11.glPopMatrix();
}
@@ -1,5 +1,6 @@
package noppes.npcs.client.renderer;
import cpw.mods.fml.common.Loader;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@@ -18,6 +19,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.event.RenderPlayerEvent;
import noppes.npcs.client.ClientCacheHandler;
import noppes.npcs.client.model.ModelMPM;
import noppes.npcs.controllers.data.SkinOverlay;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.Project;
@@ -26,6 +28,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class RenderCNPCPlayer extends RenderPlayer {
public static boolean hasMPM = false;
public Minecraft mc = Minecraft.getMinecraft();
public RenderCNPCHand itemRenderer = new RenderCNPCHand(mc);
public float tempRenderPartialTicks;
@@ -41,6 +44,9 @@ public class RenderCNPCPlayer extends RenderPlayer {
this.modelArmorChestplate = new ModelBiped(1.0F);
this.modelArmor = new ModelBiped(0.5F);
this.setRenderManager(RenderManager.instance);
if(Loader.isModLoaded("moreplayermodels"))
hasMPM = true;
}
private boolean preRenderOverlay(SkinOverlay overlayData, EntityPlayer player) {
@@ -105,10 +111,9 @@ public class RenderCNPCPlayer extends RenderPlayer {
}
@Override
protected void renderModel(EntityLivingBase p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) {
EntityPlayer player = (EntityPlayer) p_77036_1_;
if (!p_77036_1_.isInvisible())
protected void renderModel(EntityLivingBase entity, float par2, float par3, float par4, float par5, float par6, float par7) {
EntityPlayer player = (EntityPlayer) entity;
if (!entity.isInvisible())
{
if (ClientCacheHandler.skinOverlays.containsKey(player.getUniqueID())) {
for (SkinOverlay overlayData : ClientCacheHandler.skinOverlays.get(player.getUniqueID()).values()) {
@@ -122,7 +127,11 @@ public class RenderCNPCPlayer extends RenderPlayer {
if (!this.preRenderOverlay(overlayData, player))
continue;
this.modelBipedMain.render(p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_);
if(hasMPM){
renderMorePlayerModel(entity, par2, par3, par4, par5, par6, par7);
} else {
this.modelBipedMain.render(entity, par2, par3, par4, par5, par6, par7);
}
postRenderOverlay();
}
}
@@ -310,6 +319,28 @@ public class RenderCNPCPlayer extends RenderPlayer {
}
}
public void renderMorePlayerModel(EntityLivingBase entity, float par2, float par3, float par4, float par5, float par6, float par7){
Class<?> ModelMPMClass = null;
Field isArmor = null;
try {
ModelMPMClass = Class.forName("noppes.mpm.client.model.ModelMPM");
isArmor = ModelMPMClass.getDeclaredField("isArmor");
} catch (Exception ignored) {}
// Assuming this.modelBipedMain is an instance of ModelMPM
if (ModelMPMClass != null && ModelMPMClass.isInstance(this.modelBipedMain)) {
try {
// Set isArmor field to false
if (isArmor != null) {
isArmor.setBoolean(this.modelBipedMain, true);
this.modelBipedMain.render(entity, par2, par3, par4, par5, par6, par7);
isArmor.setBoolean(this.modelBipedMain, false);
}
} catch (IllegalAccessException ignored) {}
}
}
public void renderDBCModel(RenderPlayerEvent.Specials.Post event) {
EntityPlayer player = event.entityPlayer;
@@ -1,18 +1,17 @@
package noppes.npcs.client.renderer.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.ForgeHooksClient;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockScripted;
@@ -28,26 +27,58 @@ public class BlockScriptedRenderer extends BlockRendererInterface{
private static final RenderBlocks renderBlocks = new RenderBlocks();
private static final Random random = new Random();
public BlockScriptedRenderer() {
((BlockScripted) CustomItems.scripted).renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(this);
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
TileScripted tile = (TileScripted) world.getTileEntity(x, y, z);
Block blockModel = tile.blockModel;
if (!overrideModel() && blockModel != null) {
GL11.glPushMatrix();
GL11.glRotatef(tile.rotationY, 0, 1, 0);
GL11.glRotatef(tile.rotationX, 1, 0, 0);
GL11.glRotatef(tile.rotationZ, 0, 0, 1);
GL11.glScalef(tile.scaleX, tile.scaleY, tile.scaleZ);
if (blockModel != CustomItems.scripted) {
tile.renderFullBlock = renderer.renderBlockByRenderType(blockModel, x, y, z);
} else {
renderer.renderStandardBlock(blockModel, x, y, z);
tile.renderFullBlock = true;
}
GL11.glPopMatrix();
} else {
renderer.renderStandardBlock(CustomItems.scripted, x, y, z);
tile.renderFullBlock = true;
}
return true;
}
public int getRenderId() {
return CustomItems.scripted.getRenderType();
}
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks) {
TileScripted tile = (TileScripted) te;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_BLEND);
RenderHelper.enableStandardItemLighting();
GL11.glTranslatef((float) (x + 0.5), (float) y, (float) (z + 0.5));
if (overrideModel()) {
GL11.glTranslatef(0, 0.5F, 0);
renderItem(te, new ItemStack(CustomItems.scripted));
} else {
if (!tile.renderFullBlock) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_BLEND);
RenderHelper.enableStandardItemLighting();
GL11.glTranslatef((float) (x + 0.5), (float) y, (float) (z + 0.5));
GL11.glRotatef(tile.rotationY, 0, 1, 0);
GL11.glRotatef(tile.rotationX, 1, 0, 0);
GL11.glRotatef(tile.rotationZ, 0, 0, 1);
GL11.glScalef(tile.scaleX, tile.scaleY, tile.scaleZ);
GL11.glTranslatef(0, 0.5F, 0);
renderItem(te, tile.itemModel);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
if (!tile.text1.text.isEmpty()) {
drawText(tile.text1, x, y, z);
@@ -152,7 +183,7 @@ public class BlockScriptedRenderer extends BlockRendererInterface{
GL11.glPopMatrix();
}
private boolean overrideModel() {
public static boolean overrideModel() {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
if (held == null)
return false;
@@ -166,7 +197,7 @@ public class BlockScriptedRenderer extends BlockRendererInterface{
}
@Override
public int getRenderId() {
return 0;
public boolean shouldRender3DInInventory(int modelId) {
return false;
}
}
@@ -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;
}
@@ -1,4 +1,4 @@
package noppes.npcs.client.renderer.customitem;
package noppes.npcs.client.renderer.items;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
@@ -0,0 +1,77 @@
package noppes.npcs.client.renderer.items;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import noppes.npcs.CustomItems;
import org.lwjgl.opengl.GL11;
public class ScriptedBlockItemRenderer implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type != ItemRenderType.FIRST_PERSON_MAP;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
RenderBlocks renderBlocks = (RenderBlocks) data[0];
if (type == ItemRenderType.INVENTORY) {
GL11.glTranslatef(0, -0.1f, 0);
renderBlock(item, renderBlocks);
} else if (type == ItemRenderType.EQUIPPED) {
GL11.glTranslatef(0.5F, 0.4F, 0.5F);
renderBlock(item, renderBlocks);
} else if (type == ItemRenderType.ENTITY) {
renderBlock(item, renderBlocks);
} else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
GL11.glTranslatef(0.5F, 0.4F, 0.5F);
renderBlock(item, renderBlocks);
}
}
private void renderBlock(ItemStack item, RenderBlocks renderBlocks) {
Tessellator tessellator = Tessellator.instance;
Block block = CustomItems.scripted;
int p_147800_2_ = item.getItemDamage();
block.setBlockBoundsForItemRender();
renderBlocks.setRenderBoundsFromBlock(block);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.4F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1.0F, 0.0F);
renderBlocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocks.getBlockIconFromSideAndMetadata(block, 0, p_147800_2_));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderBlocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocks.getBlockIconFromSideAndMetadata(block, 1, p_147800_2_));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1.0F);
renderBlocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocks.getBlockIconFromSideAndMetadata(block, 2, p_147800_2_));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderBlocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocks.getBlockIconFromSideAndMetadata(block, 3, p_147800_2_));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
renderBlocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocks.getBlockIconFromSideAndMetadata(block, 4, p_147800_2_));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderBlocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocks.getBlockIconFromSideAndMetadata(block, 5, p_147800_2_));
tessellator.draw();
}
}
@@ -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;
@@ -228,6 +228,8 @@ public class ScriptContainer {
}
public boolean hasCode() {
if(!scripts.isEmpty())
return true;
return !this.getFullCode().isEmpty();
}
@@ -4,6 +4,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import jdk.nashorn.api.scripting.ClassFilter;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
@@ -24,12 +25,11 @@ import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.*;
import java.util.*;
import static noppes.npcs.util.CustomNPCsThreader.customNPCThread;
public class ScriptController {
public static ScriptController Instance;
@@ -42,9 +42,7 @@ public class ScriptController {
public File dir;
public NBTTagCompound compound = new NBTTagCompound();
private boolean loaded = false;
public boolean shouldSave = false;
public PlayerDataScript playerScripts = new PlayerDataScript((EntityPlayer)null);
public long lastPlayerUpdate = 0L;
@@ -55,7 +53,6 @@ public class ScriptController {
public long lastGlobalNpcUpdate = 0L;
public ScriptController(){
loaded = false;
Instance = this;
manager = new ScriptEngineManager();
if(!ConfigScript.ScriptingEnabled)
@@ -176,6 +173,26 @@ public class ScriptController {
}
}
public synchronized void saveForgeScriptsSync(){
customNPCThread.execute(this::saveForgeScripts);
}
public synchronized void savePlayerScriptsSync(){
customNPCThread.execute(() -> {
File file = this.playerScriptsFile();
try {
NBTJsonUtil.SaveFile(file, this.playerScripts.writeToNBT(new NBTTagCompound()));
this.playerScripts.lastInited = -1L;
} catch (IOException | JsonException var4) {
var4.printStackTrace();
}
});
}
public synchronized void saveGlobalScriptsSync(){
customNPCThread.execute(this::saveGlobalNpcScripts);
}
public void loadCategories(){
dir = new File(CustomNpcs.getWorldSaveDirectory(), "scripts");
if(!dir.exists())
@@ -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()));
@@ -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
@@ -305,4 +305,4 @@ public class DataScript implements INpcScriptHandler {
public Collection<ScriptContainer> getNPCScripts() {
return this.scripts.values();
}
}
}
@@ -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) {
@@ -80,4 +80,12 @@ public class TintData {
public void setGeneralAlpha(int generalAlpha) {
this.generalAlpha = generalAlpha;
}
public boolean processColor(boolean isHurt){
if(isHurt){
return (isTintEnabled() && (!isHurtTintEnabled() && !isGeneralTintEnabled()));
} else {
return !(isTintEnabled() && isGeneralTintEnabled());
}
}
}
@@ -2,6 +2,8 @@ package noppes.npcs.entity;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import io.netty.buffer.ByteBuf;
import kamkeel.addon.DBCAddon;
import kamkeel.addon.client.DBCClient;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.command.ICommandSender;
@@ -232,41 +234,49 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
}
@Override
public boolean attackEntityAsMob(Entity par1Entity){
public boolean attackEntityAsMob(Entity receiver){
float f = stats.getAttackStrength();
if (stats.attackSpeed < 10){
par1Entity.hurtResistantTime = 0;
receiver.hurtResistantTime = 0;
}
if(par1Entity instanceof EntityLivingBase && !isRemote()){
NpcEvent.MeleeAttackEvent event = new NpcEvent.MeleeAttackEvent(wrappedNPC, f, (EntityLivingBase)par1Entity);
if(receiver instanceof EntityLivingBase && !isRemote()){
NpcEvent.MeleeAttackEvent event = new NpcEvent.MeleeAttackEvent(wrappedNPC, f, (EntityLivingBase)receiver);
if(EventHooks.onNPCMeleeAttack(this, event))
return false;
f = event.getDamage();
}
boolean var4 = par1Entity.attackEntityFrom(new NpcDamageSource("mob", this), f);
boolean didAttack = false;
if(DBCAddon.instance.canDBCAttack(this, f, receiver)){
didAttack = receiver.attackEntityFrom(new NpcDamageSource("mob", this), 1.0f);
if(didAttack)
DBCAddon.instance.doDBCDamage(this, f, receiver);
}
else
didAttack = receiver.attackEntityFrom(new NpcDamageSource("mob", this), f);
if (var4){
if (didAttack){
if(getOwner() instanceof EntityPlayer)
NPCEntityHelper.setRecentlyHit((EntityLivingBase)par1Entity);
NPCEntityHelper.setRecentlyHit((EntityLivingBase)receiver);
if (stats.knockback > 0){
par1Entity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)stats.knockback * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)stats.knockback * 0.5F));
receiver.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)stats.knockback * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)stats.knockback * 0.5F));
this.motionX *= 0.6D;
this.motionZ *= 0.6D;
}
if(advanced.role == EnumRoleType.Companion){
((RoleCompanion)roleInterface).attackedEntity(par1Entity);
((RoleCompanion)roleInterface).attackedEntity(receiver);
}
}
if (stats.potionType != EnumPotionType.None){
if (stats.potionType != EnumPotionType.Fire)
((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(this.getPotionEffect(stats.potionType), stats.potionDuration * 20, stats.potionAmp));
((EntityLivingBase)receiver).addPotionEffect(new PotionEffect(this.getPotionEffect(stats.potionType), stats.potionDuration * 20, stats.potionAmp));
else
par1Entity.setFire(stats.potionDuration);
receiver.setFire(stats.potionDuration);
}
return var4;
return didAttack;
}
@Override
@@ -283,15 +293,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));
}
}
@@ -377,6 +389,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
}
if(advanced.job == EnumJobType.Bard)
((JobBard)jobInterface).onLivingUpdate();
DBCClient.Instance.renderDBCAuras(this);
}
}
@@ -19,7 +19,7 @@ public abstract class MixinEntityRenderer {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (ClientEventHandler.hasOverlays(player)) {
GL11.glPushMatrix();
ClientEventHandler.renderCNPCPlayer.renderHand(p_78476_1_,0);
ClientEventHandler.renderCNPCSelf.renderHand(p_78476_1_,0);
GL11.glPopMatrix();
}
}
@@ -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;
@@ -18,6 +18,7 @@ import java.util.*;
public class QuestItem extends QuestInterface implements IQuestItem {
public NpcMiscInventory items = new NpcMiscInventory(3);
public static EntityPlayer pickedUpPlayerSolo;
public static ItemStack pickedUp;
public static ItemStack pickedUpParty;
@@ -81,12 +81,24 @@ public class BlockScriptedWrapper extends ScriptBlock implements IBlockScripted{
@Override
public void setIsPassible(boolean bo){
setIsPassable(bo);
}
@Override
public boolean getIsPassible(){
return getIsPassable();
}
@Override
public void setIsPassable(boolean bo){
tile.isPassible = bo;
tile.needsClientUpdate = true;
}
@Override
public boolean getIsPassible(){
public boolean getIsPassable(){
if(tile == null)
return false;
return tile.isPassible;
}
@@ -97,6 +109,8 @@ public class BlockScriptedWrapper extends ScriptBlock implements IBlockScripted{
@Override
public int getLight(){
if(tile == null)
return 0;
return tile.lightValue;
}
@@ -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));
}
}
@@ -1,6 +1,7 @@
package noppes.npcs.scripted.entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.IPos;
import noppes.npcs.api.ITimers;
@@ -617,7 +618,11 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
* @param item The item the drop list slot will be changed to
*/
public void setLootItem(int slot, IItemStack item) {
npc.inventory.setInventorySlotContents(slot+7, item.getMCItemStack());
if(item == null || item.getMCItemStack() == null){
npc.inventory.setInventorySlotContents(slot+7, (ItemStack) null);
} else {
npc.inventory.setInventorySlotContents(slot+7, item.getMCItemStack());
}
}
/**
@@ -1319,7 +1324,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 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 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 class NpcEvent extends CustomNPCsEvent implements INpcEvent {
/**
* @return Returns the swung item
*/
@Override
public IItemStack getItemStack() {
return itemStack;
}
@@ -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);
}
}
@@ -302,6 +302,8 @@ availability.before=Before
availability.available=Available
availability.whenactive=When Active
availability.whennotactive=When Not Active
availability.acceptable=Acceptable
availability.notacceptable=Not Acceptable
availability.selectquest=Select Quest
availability.selectdialog=Select Dialog
availability.selectfaction=Select Faction