本文整理汇总了Java中net.minecraft.network.datasync.DataParameter类的典型用法代码示例。如果您正苦于以下问题:Java DataParameter类的具体用法?Java DataParameter怎么用?Java DataParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataParameter类属于net.minecraft.network.datasync包,在下文中一共展示了DataParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: set
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public <T> void set(@Nonnull DataParameter<T> key, @Nonnull T value) {
if (key == EntityPlayer.ABSORPTION) {
float floatValue = (Float) value;
if (player instanceof EntityPlayerMP) { //may be EntityOtherPlayerMP as well
EntityPlayerMP playerMP = (EntityPlayerMP) player;
if (playerMP.connection != null) //also fired when connecting, ignore(otherwise the net handler would crash)
FirstAid.NETWORKING.sendTo(new MessageApplyAbsorption(floatValue), playerMP);
}
PlayerDataManager.getDamageModel(player).setAbsorption(floatValue);
} else if (key == EntityLivingBase.HEALTH) {
if (!player.world.isRemote && (Float) value > player.getMaxHealth())
PlayerDataManager.getDamageModel(player).forEach(damageablePart -> damageablePart.currentHealth = damageablePart.getMaxHealth());
}
set_impl(key, value);
}
示例2: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
super.notifyDataManagerChange(key);
if (HAND_STATES.equals(key))
{
boolean flag = (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 1) > 0;
EnumHand enumhand = (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND;
if (flag && !this.handActive)
{
this.setActiveHand(enumhand);
}
else if (!flag && this.handActive)
{
this.resetActiveHand();
}
}
if (FLAGS.equals(key) && this.isElytraFlying() && !this.wasFallFlying)
{
this.mc.getSoundHandler().playSound(new ElytraSound(this));
}
}
示例3: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
super.notifyDataManagerChange(key);
if (LAST_OUTPUT.equals(key))
{
try
{
this.commandBlockLogic.setLastOutput((ITextComponent)this.getDataManager().get(LAST_OUTPUT));
}
catch (Throwable var3)
{
;
}
}
else if (COMMAND.equals(key))
{
this.commandBlockLogic.setCommand((String)this.getDataManager().get(COMMAND));
}
}
示例4: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
super.notifyDataManagerChange(key);
if (HAND_STATES.equals(key) && this.world.isRemote)
{
if (this.isHandActive() && this.activeItemStack.func_190926_b())
{
this.activeItemStack = this.getHeldItem(this.getActiveHand());
if (!this.activeItemStack.func_190926_b())
{
this.activeItemStackUseCount = this.activeItemStack.getMaxItemUseDuration();
}
}
else if (!this.isHandActive() && !this.activeItemStack.func_190926_b())
{
this.activeItemStack = ItemStack.field_190927_a;
this.activeItemStackUseCount = 0;
}
}
}
示例5: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
if (SLIME_SIZE.equals(key))
{
int i = this.getSlimeSize();
this.setSize(0.51000005F * (float)i, 0.51000005F * (float)i);
this.rotationYaw = this.rotationYawHead;
this.renderYawOffset = this.rotationYawHead;
if (this.isInWater() && this.rand.nextInt(20) == 0)
{
this.resetHeight();
}
}
super.notifyDataManagerChange(key);
}
示例6: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public void notifyDataManagerChange(DataParameter<?> key) {
this.adjustSize();
// System.out.println("Watcher update: "+data);
if (!this.world.isRemote && key == CONSTRUCTING) {
this.setSoundState(this.dataManager.get(CONSTRUCTING) >= this.getConstructionTime()? 0 : 25);
}
if (this.world.isRemote && key == SOUND_STATE) {
SoundEvent sound = this.getSoundNameForState(this.getSoundState());
if (sound != null) {
// System.out.println("Playing Sound: "+sound);
if (this.buildingSound != null)
this.buildingSound.stopPlaying();
this.buildingSound = new BuildingSound(this, sound, this.getSoundState());
ClientProxy.playBuildingSound(buildingSound);
}
else{
if(this.buildingSound != null)
this.buildingSound.stopPlaying();
}
}
}
示例7: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
super.notifyDataManagerChange(key);
if (HAND_STATES.equals(key) && this.worldObj.isRemote)
{
if (this.isHandActive() && this.activeItemStack == null)
{
this.activeItemStack = this.getHeldItem(this.getActiveHand());
if (this.activeItemStack != null)
{
this.activeItemStackUseCount = this.activeItemStack.getMaxItemUseDuration();
}
}
else if (!this.isHandActive() && this.activeItemStack != null)
{
this.activeItemStack = null;
this.activeItemStackUseCount = 0;
}
}
}
示例8: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
if (IS_CHILD.equals(key))
{
this.setChildSize(this.isChild());
}
else if (VILLAGER_TYPE.equals(key))
{
net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, ZombieType.getByOrdinal(this.getDataManager().get(VILLAGER_TYPE)), this.getDataManager().get(VILLAGER_TYPE));
}
else if (VILLAGER_TYPE_STR.equals(key))
{
String name = this.getDataManager().get(VILLAGER_TYPE_STR);
net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p =
"".equals(name) ? null : net.minecraftforge.fml.common.registry.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new ResourceLocation(name));
this.setVillagerType(p);
}
super.notifyDataManagerChange(key);
}
示例9: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
super.notifyDataManagerChange(key);
if (STATUS.equals(key))
{
if (this.isElder() && this.width < 1.0F)
{
this.setSize(1.9975F, 1.9975F);
}
}
else if (TARGET_ENTITY.equals(key))
{
this.clientSideAttackTime = 0;
this.targetedEntity = null;
}
}
示例10: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public void notifyDataManagerChange(DataParameter<?> key) {
super.notifyDataManagerChange(key);
if(key == SUCCESS) {
success = dataManager.get(SUCCESS).booleanValue();
} else if(container == null) {
if(dataManager.get(RITUAL) != null && dataManager.get(RECIPE) != null &&
dataManager.get(TOTAL_TICKS) != null) {
loadFromData(dataManager.get(RITUAL), dataManager.get(RECIPE),
dataManager.get(TOTAL_TICKS), dataManager.get(TICKS_LEFT), true);
}
} else if(key == TICKS_LEFT) {
container.ticksLeft = dataManager.get(TICKS_LEFT).intValue();
}
}
示例11: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public void notifyDataManagerChange(DataParameter<?> key) {
if (PLAYER_ID.equals(key)) {
if (this.world.isRemote) {
Entity entity = world.getEntityByID(this.dataManager.get(PLAYER_ID));
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
if (player != null) {
this.getAngler().fishEntity = null;
this.angler = player;
this.angler.fishEntity = this;
}
}
}
}
super.notifyDataManagerChange(key);
}
示例12: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
if (IS_CHILD.equals(key))
{
this.setChildSize(this.isChild());
}
else if (VILLAGER_TYPE.equals(key))
{
net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, ZombieType.func_190146_a(this.getDataManager().get(VILLAGER_TYPE)), this.getDataManager().get(VILLAGER_TYPE));
}
else if (VILLAGER_TYPE_STR.equals(key))
{
String name = this.getDataManager().get(VILLAGER_TYPE_STR);
net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p =
"".equals(name) ? null : net.minecraftforge.fml.common.registry.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new ResourceLocation(name));
this.setVillagerType(p);
}
super.notifyDataManagerChange(key);
}
示例13: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public void notifyDataManagerChange(DataParameter<?> key)
{
super.notifyDataManagerChange(key);
if (HAND_STATES.equals(key))
{
boolean flag = (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 1) > 0;
EnumHand enumhand = (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND;
if (flag && !this.handActive)
{
this.setActiveHand(enumhand);
}
else if (!flag && this.handActive)
{
this.resetActiveHand();
}
}
if (FLAGS.equals(key) && this.isElytraFlying() && !this.field_189813_ct)
{
this.mc.getSoundHandler().playSound(new ElytraSound(this));
}
}
示例14: DragonBreedHelper
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
public DragonBreedHelper(EntityTameableDragon dragon, DataParameter<String> dataParam) {
super(dragon);
this.dataParam = dataParam;
if (dragon.isServer()) {
// initialize map to avoid future checkings
for (EnumDragonBreed type : EnumDragonBreed.values()) {
breedPoints.put(type, new AtomicInteger());
}
// default breed has initial points
breedPoints.get(EnumDragonBreed.DEFAULT).set(POINTS_INITIAL);
}
dataWatcher.register(dataParam, EnumDragonBreed.DEFAULT.getName());
}
示例15: notifyDataManagerChange
import net.minecraft.network.datasync.DataParameter; //导入依赖的package包/类
@Override
public void notifyDataManagerChange(DataParameter<?> key) {
if (m_realPlayer == null) {
super.notifyDataManagerChange(key);
} else {
syncToRealPlayer();
m_realPlayer.notifyDataManagerChange(key);
syncPublicFieldsFromReal();
}
}