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

This commit is contained in:
Luis C.M. committed 2024-10-26 10:46:09 -05:00
commit 8c10235ee2
16 files changed
+205 -82

No files matched your search

+2 -2
View File
@@ -21,7 +21,7 @@ jobs:
run: ./gradlew SetupCIWorkspace build
- name: Build with Gradle (nomixin)
run: ./gradlew build -Pnomixin
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: Package
path: build/libs
path: build/libs
+1 -1
View File
@@ -5,7 +5,7 @@ plugins {
id 'idea'
}
version = "1.9.3"
version = "1.9.3-hotfix"
group= "kamkeel.customnpc-plus"
archivesBaseName = "CustomNPC-Plus"
+65 -5
View File
@@ -1,3 +1,13 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.2
# Whether to automatically set the version based on the VERSION environment variable or the current git status.
gtnh.modules.gitVersion = false
# Sets up code style plugins like Spotless and Checkstyle.
gtnh.modules.codeStyle = true
# Human-readable mod name, available for mcmod.info population.
modName = CustomNPC+
@@ -8,10 +18,6 @@ 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.3
gtnh.modules.codeStyle=true
gtnh.modules.gitVersion=false
# Whether to use modGroup as the maven publishing group.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
@@ -22,10 +28,14 @@ autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
channel = stable
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
@@ -71,25 +81,53 @@ accessTransformersFile = customnpcs_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = true
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = true
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin = mixin.CustomNPCsMixinPlugin
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage = mixin
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
usesShadowedDependencies = true
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = false
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = false
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
@@ -103,8 +141,28 @@ usesMavenPublishing = false
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
@@ -140,3 +198,5 @@ disableCheckstyle = true
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
# Non-GTNH properties
modVersion = 1.9.3
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored Regular → Executable
View File
File mode changed.
+1 -1
View File
@@ -17,5 +17,5 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.14'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
}
@@ -442,17 +442,19 @@ public class ScriptPlayerEventHandler {
return;
if(event.entityLiving.worldObj instanceof WorldServer) {
boolean cancel = event.isCanceled();
Entity source = NoppesUtilServer.GetDamageSource(event.source);
PlayerDataScript handler = ScriptController.Instance.playerScripts;
if(event.entityLiving instanceof EntityPlayer) {
noppes.npcs.scripted.event.PlayerEvent.AttackedEvent pevent = new noppes.npcs.scripted.event.PlayerEvent.AttackedEvent((IPlayer)NpcAPI.Instance().getIEntity((EntityPlayer)event.entityLiving), source, event.ammount, event.source);
event.setCanceled(EventHooks.onPlayerAttacked(handler, pevent));
cancel = EventHooks.onPlayerAttacked(handler, pevent);
}
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));
cancel = cancel || EventHooks.onPlayerAttack(handler, pevent1);
}
event.setCanceled(cancel);
}
}
@@ -462,19 +464,22 @@ public class ScriptPlayerEventHandler {
return;
if(event.entityLiving.worldObj instanceof WorldServer) {
boolean cancel = event.isCanceled();
Entity source = NoppesUtilServer.GetDamageSource(event.source);
PlayerDataScript handler = ScriptController.Instance.playerScripts;
if(event.entityLiving instanceof EntityPlayer) {
noppes.npcs.scripted.event.PlayerEvent.DamagedEvent pevent = new noppes.npcs.scripted.event.PlayerEvent.DamagedEvent((IPlayer)NpcAPI.Instance().getIEntity((EntityPlayer)event.entityLiving), source, event.ammount, event.source);
event.setCanceled(EventHooks.onPlayerDamaged(handler, pevent));
cancel = EventHooks.onPlayerDamaged(handler, pevent);
event.ammount = pevent.damage;
}
if(source instanceof EntityPlayer) {
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));
cancel = cancel || EventHooks.onPlayerDamagedEntity(handler, pevent1);
event.ammount = pevent1.damage;
}
event.setCanceled(cancel);
}
}
+5 -1
View File
@@ -15,6 +15,7 @@ import net.minecraft.village.MerchantRecipeList;
import noppes.npcs.constants.EnumPacketClient;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -45,6 +46,7 @@ public class Server {
CustomNpcs.Channel.sendToAllAround(new FMLProxyPacket(buffer,"CustomNPCs"), point);
} catch (IOException e) {
e.printStackTrace();
LogWriter.error(enu + " Errored", e);
}
}
public static void sendToAll(EnumPacketClient enu, Object... obs) {
@@ -55,6 +57,7 @@ public class Server {
CustomNpcs.Channel.sendToAll(new FMLProxyPacket(buffer,"CustomNPCs"));
} catch (IOException e) {
e.printStackTrace();
LogWriter.error(enu + " Errored", e);
}
}
@@ -106,7 +109,8 @@ public class Server {
}
if(buffer.array().length >= 32767){
LogWriter.error("Packet " + enu + " was too big to be send");
return false;
LogWriter.script( "Issue occurred with the following Packet - " + enu + ":\n" + Arrays.toString(obs));
return false;
}
return true;
}
@@ -324,8 +324,15 @@ public class ServerEventsHandler {
private void doQuest(EntityPlayer player, EntityLivingBase entity, boolean all) {
PlayerData playerData = PlayerData.get(player);
PlayerQuestData questData = playerData.questData;
boolean checkCompletion = false;
if (playerData == null) {
return;
}
PlayerQuestData questData = playerData.questData;
if (questData == null) {
return;
}
boolean checkCompletion = false;
String entityName = EntityList.getEntityString(entity);
@@ -343,6 +350,10 @@ public class ServerEventsHandler {
ArrayList<QuestData> activeQuestValues = new ArrayList<>(questData.activeQuests.values());
for(QuestData data : activeQuestValues){
if (data.quest == null) {
continue;
}
if (data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
continue;
@@ -360,9 +371,12 @@ public class ServerEventsHandler {
}
String name = entityName;
QuestKill quest = (QuestKill) data.quest.questInterface;
String name = entityName;
if (entityName == null) {
continue;
}
QuestKill quest = (QuestKill) data.quest.questInterface;
Class entityType = EntityNPCInterface.class;
if (quest.targetType == 2) {
try {
@@ -375,14 +389,19 @@ public class ServerEventsHandler {
if (quest.targetType > 0 && !(entityType.isInstance(entity)))
continue;
if (entity.getCommandSenderName() != null && quest.targets.containsKey(entity.getCommandSenderName()))
name = entity.getCommandSenderName();
else if (entity.getCommandSenderName() == null || !quest.targets.containsKey(name))
continue;
if (entity.getCommandSenderName() != null && quest.targets != null && quest.targets.containsKey(entity.getCommandSenderName())) {
name = entity.getCommandSenderName();
} else if (entity.getCommandSenderName() == null || quest.targets == null || !quest.targets.containsKey(name)) {
continue;
}
checkCompletion = true;
HashMap<String, Integer> killed = quest.getKilled(data);
HashMap<String, Integer> killed = quest.getKilled(data);
if (killed == null) {
killed = new HashMap<>();
}
if (!killed.containsKey(name)) {
killed.put(name, 1);
} else if(killed.get(name) < quest.targets.get(name)) {
@@ -6,11 +6,13 @@ import net.minecraft.client.audio.SoundHandler;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
public class MusicController {
public static MusicController Instance;
private final HashSet<ScriptClientSound> sounds = new HashSet<>();
private final HashMap<String, ScriptClientSound> sounds = new HashMap<>();
private int playDelay;
public ScriptClientSound playingSound;
@@ -36,7 +38,16 @@ public class MusicController {
}
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
this.sounds.removeIf(sound -> !soundHandler.isSoundPlaying(sound) && !sound.canRepeat() && !sound.paused);
HashSet<String> keys = new HashSet<>();
for (Map.Entry<String, ScriptClientSound> entry : this.sounds.entrySet()) {
ScriptClientSound sound = entry.getValue();
if (!soundHandler.isSoundPlaying(sound) && !sound.canRepeat() && !sound.paused) {
keys.add(entry.getKey());
}
}
for (String key : keys) {
this.sounds.remove(key);
}
if (this.playDelay > 0) {
this.playDelay--;
@@ -75,7 +86,7 @@ public class MusicController {
this.playingSound = clientSound;
this.entity = entity;
this.offRange = offRange;
this.sounds.add(clientSound);
this.sounds.put(clientSound.sound, clientSound);
try {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
@@ -102,7 +113,7 @@ public class MusicController {
this.playingSound = clientSound;
this.entity = entity;
this.offRange = offRange;
this.sounds.add(clientSound);
this.sounds.put(clientSound.sound, clientSound);
try {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
@@ -131,10 +142,12 @@ public class MusicController {
this.stopAllSounds();
return;
}
this.sounds.add(clientSound);
this.sounds.put(clientSound.sound, clientSound);
}
public boolean isPlaying(String music) {
if (this.sounds.containsKey(music)) return true;
if (this.playingSound != null && this.playingSound.sound.equals(music)) {
ResourceLocation resource = new ResourceLocation(music);
if (!this.playingSound.getPositionedSoundLocation().equals(resource)) {
@@ -168,7 +181,7 @@ public class MusicController {
public void stopAllSounds() {
this.stopMusic();
for (ScriptClientSound sound : this.sounds) {
for (ScriptClientSound sound : this.sounds.values()) {
sound.stopSound();
}
this.sounds.clear();
@@ -169,14 +169,16 @@ public class ConfigScript
}
public static boolean isScriptDev(EntityPlayer player) {
boolean isOp = MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile());
return (!ScriptOpsOnly || isOp) &&
(Developer.ScriptUser.contains(player.getUniqueID()) ||
Developer.Universal.contains(player.getUniqueID()));
return Developer.ScriptUser.contains(player.getUniqueID()) || Developer.Universal.contains(player.getUniqueID());
}
public static boolean canScript(EntityPlayer player, CustomNpcsPermissions.Permission perm) {
boolean scriptDev = (!ScriptOpsOnly && Developer.ScriptUser.isEmpty()) || isScriptDev(player);
return scriptDev && CustomNpcsPermissions.hasPermission(player, perm);
boolean isOp = MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile());
boolean scriptDev = isScriptDev(player);
if(ScriptOpsOnly){
return isOp || scriptDev;
}
return scriptDev || CustomNpcsPermissions.hasPermission(player, perm);
}
}
@@ -45,7 +45,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() > 40){
if(questList.tagCount() > 20){
questCompound = new NBTTagCompound();
questCompound.setTag("Data", questList);
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
@@ -69,7 +69,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() > 40){
if(dialogList.tagCount() > 20){
dialogCompound = new NBTTagCompound();
dialogCompound.setTag("Data", dialogList);
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
@@ -100,7 +100,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() > 40){
if(dialogList.tagCount() > 20){
dialogCompound = new NBTTagCompound();
dialogCompound.setTag("Data", dialogList);
dialogCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
@@ -123,7 +123,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() > 40){
if(questList.tagCount() > 20){
questCompound = new NBTTagCompound();
questCompound.setTag("Data", questList);
questCompound.setTag("CatNBT", category.writeSmallNBT(new NBTTagCompound()));
@@ -145,7 +145,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() > 40){
if(questList.tagCount() > 20){
questCompound = new NBTTagCompound();
questCompound.setTag("Data", questList);
questCompound.setTag("CatNBT", questCategory.writeSmallNBT(new NBTTagCompound()));
@@ -165,7 +165,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() > 40){
if(dialogList.tagCount() > 20){
dialogCompound = new NBTTagCompound();
dialogCompound.setTag("Data", dialogList);
dialogCompound.setTag("CatNBT", dialogCategory.writeSmallNBT(new NBTTagCompound()));
@@ -284,7 +284,7 @@ public class SyncController {
dialog.category = category;
category.dialogs.put(dialog.id, dialog);
}
DialogController.Instance.categoriesSync.put(category.id, category);
DialogController.Instance.categories.put(category.id, category);
}
else if(synctype == SyncType.QUEST){
QuestCategory category = QuestController.Instance.categories.get(buffer.readInt());
@@ -35,13 +35,13 @@ public class ItemNpcScripter extends Item{
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player){
if(!world.isRemote)
if (!world.isRemote) {
if(!ConfigScript.canScript(player, CustomNpcsPermissions.TOOL_SCRIPTER)){
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
}
return itemStack;
if(!ConfigScript.canScript(player, CustomNpcsPermissions.TOOL_SCRIPTER)){
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
} else {
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptEvent, player);
}
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptEvent, player);
return itemStack;
}
+45 -23
View File
@@ -195,29 +195,51 @@ public class NpcAPI extends AbstractNpcAPI {
return ((EntityNPCInterface)entity).wrappedNPC;
else{
ScriptEntityData data = (ScriptEntityData) entity.getExtendedProperties("ScriptedObject");
if(data != null)
return data.base;
if(entity instanceof EntityPlayerMP)
data = new ScriptEntityData(new ScriptPlayer<>((EntityPlayerMP) entity));
else if(PixelmonHelper.isPixelmon(entity))
return new ScriptPixelmon<EntityTameable>((EntityTameable) entity);
else if(entity instanceof EntityAnimal)
data = new ScriptEntityData(new ScriptAnimal<>((EntityAnimal) entity));
else if(entity instanceof EntityMob)
data = new ScriptEntityData(new ScriptMonster<>((EntityMob) entity));
else if(entity instanceof EntityVillager)
data = new ScriptEntityData(new ScriptVillager<>((EntityVillager) entity));
else if(entity instanceof EntityLiving)
data = new ScriptEntityData(new ScriptLiving<>((EntityLiving) entity));
else if(entity instanceof EntityLivingBase)
data = new ScriptEntityData(new ScriptLivingBase<>((EntityLivingBase)entity));
else if(entity instanceof EntityProjectile)
data = new ScriptEntityData(new ScriptProjectile<>((EntityProjectile)entity));
else if(entity instanceof EntityItem)
data = new ScriptEntityData(new ScriptEntityItem<>((EntityItem)entity));
else
data = new ScriptEntityData(new ScriptEntity<>(entity));
entity.registerExtendedProperties("ScriptedObject", data);
boolean isDBC = false;
if(entity instanceof EntityPlayerMP) {
Set<?> keySet = entity.getEntityData().getCompoundTag("PlayerPersisted").func_150296_c();
for (Object o : keySet) {
String s = (String) o;
if (s.contains("jrmc")) {
isDBC = true;
break;
}
}
}
if (data == null || data.base instanceof ScriptDBCPlayer != isDBC) {
if (entity instanceof EntityPlayerMP) {
ScriptEntityData newData;
if (isDBC) {
newData = new ScriptEntityData(new ScriptDBCPlayer<>((EntityPlayerMP) entity));
} else {
newData = new ScriptEntityData(new ScriptPlayer<>((EntityPlayerMP) entity));
}
if (data != null) {
((ScriptEntity<?>) newData.base).copyTempData(data.base);
}
data = newData;
}
else if (PixelmonHelper.isPixelmon(entity))
return new ScriptPixelmon<EntityTameable>((EntityTameable) entity);
else if (entity instanceof EntityAnimal)
data = new ScriptEntityData(new ScriptAnimal<>((EntityAnimal) entity));
else if (entity instanceof EntityMob)
data = new ScriptEntityData(new ScriptMonster<>((EntityMob) entity));
else if (entity instanceof EntityVillager)
data = new ScriptEntityData(new ScriptVillager<>((EntityVillager) entity));
else if (entity instanceof EntityLiving)
data = new ScriptEntityData(new ScriptLiving<>((EntityLiving) entity));
else if (entity instanceof EntityLivingBase)
data = new ScriptEntityData(new ScriptLivingBase<>((EntityLivingBase) entity));
else if (entity instanceof EntityProjectile)
data = new ScriptEntityData(new ScriptProjectile<>((EntityProjectile) entity));
else if (entity instanceof EntityItem)
data = new ScriptEntityData(new ScriptEntityItem<>((EntityItem) entity));
else
data = new ScriptEntityData(new ScriptEntity<>(entity));
entity.registerExtendedProperties("ScriptedObject", data);
}
return data.base;
}
}
@@ -33,7 +33,7 @@ import java.util.*;
public class ScriptEntity<T extends Entity> implements IEntity {
protected T entity;
private Map<String,Object> tempData = new HashMap<String,Object>();
private Map<String,Object> tempData = new HashMap<>();
public ScriptEntity(T entity){
this.entity = entity;
@@ -513,6 +513,12 @@ public class ScriptEntity<T extends Entity> implements IEntity {
return tempData.get(key);
}
public void copyTempData(IEntity<?> scriptEntity) {
if (scriptEntity != null) {
this.tempData = ((ScriptEntity<?>) scriptEntity).tempData;
}
}
/**
* Tempdata gets cleared when the entity gets unloaded or the world restarts
* @param key The key for the data stored
@@ -705,17 +705,9 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
return data.getGUIOpen();
}
@Deprecated
public ScriptDBCPlayer<T> getDBCPlayer() {
Set keySet = player.getEntityData().getCompoundTag("PlayerPersisted").func_150296_c();
Iterator iterator = keySet.iterator();
while (iterator.hasNext())
{
String s = (String)iterator.next();
if(s.contains("jrmc"))
return new ScriptDBCPlayer<T>(this.player);
}
return null;
return this instanceof ScriptDBCPlayer ? (ScriptDBCPlayer<T>) this : null;
}
public boolean blocking() {