@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); }
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)); } }
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)); } }
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; } } }
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); }
@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(); } } }
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; } } }
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); }
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; } }
@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(); } }
@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); }
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); }
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)); } }
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()); }
@Override public void notifyDataManagerChange(DataParameter<?> key) { if (m_realPlayer == null) { super.notifyDataManagerChange(key); } else { syncToRealPlayer(); m_realPlayer.notifyDataManagerChange(key); syncPublicFieldsFromReal(); } }
@Override public void notifyDataManagerChange(DataParameter<?> key) { if (m_realPlayer == null) { super.notifyDataManagerChange(key); } else { m_realPlayer.notifyDataManagerChange(key); } }
@SuppressWarnings("unchecked") @Override @Nonnull public <T> T get(@Nonnull DataParameter<T> key) { if (key == EntityPlayer.ABSORPTION) parent.set(key, (T) PlayerDataManager.getDamageModel(player).getAbsorption()); return parent.get(key); }
@Override public void notifyDataManagerChange(DataParameter<?> key) { if (SCREAMING.equals(key) && isScreaming() && EasyMappings.world(this).isRemote) { playEndermanSound(); } super.notifyDataManagerChange(key); }
protected void entityInit() { this.dataManager.register(TIME_SINCE_HIT, Integer.valueOf(0)); this.dataManager.register(FORWARD_DIRECTION, Integer.valueOf(1)); this.dataManager.register(DAMAGE_TAKEN, Float.valueOf(0.0F)); this.dataManager.register(BOAT_TYPE, Integer.valueOf(EntityBoat.Type.OAK.ordinal())); for (DataParameter<Boolean> dataparameter : DATA_ID_PADDLE) { this.dataManager.register(dataparameter, Boolean.valueOf(false)); } }
public void notifyDataManagerChange(DataParameter<?> key) { if (key.equals(ITEM)) { ItemStack itemstack = this.getDisplayedItem(); if (!itemstack.func_190926_b() && itemstack.getItemFrame() != this) { itemstack.setItemFrame(this); } } }
public void notifyDataManagerChange(DataParameter<?> key) { if (FUSE.equals(key)) { this.fuse = this.getFuseDataManager(); } }
public void notifyDataManagerChange(DataParameter<?> key) { if (STATUS.equals(key)) { this.setSize(0.5F, 1.975F); } super.notifyDataManagerChange(key); }
public void notifyDataManagerChange(DataParameter<?> key) { if (DATA_HOOKED_ENTITY.equals(key)) { int i = ((Integer)this.getDataManager().get(DATA_HOOKED_ENTITY)).intValue(); this.caughtEntity = i > 0 ? this.world.getEntityByID(i - 1) : null; } super.notifyDataManagerChange(key); }
public void notifyDataManagerChange(DataParameter<?> key) { if (field_191520_bx.equals(key) && this.world.isRemote) { this.boosting = true; this.boostTime = 0; this.totalBoostTime = ((Integer)this.dataManager.get(field_191520_bx)).intValue(); } super.notifyDataManagerChange(key); }
public void notifyDataManagerChange(DataParameter<?> key) { if (ATTACHED_BLOCK_POS.equals(key) && this.world.isRemote && !this.isRiding()) { BlockPos blockpos = this.getAttachmentPos(); if (blockpos != null) { if (this.currentAttachmentPosition == null) { this.currentAttachmentPosition = blockpos; } else { this.clientSideTeleportInterpolation = 6; } this.posX = (double)blockpos.getX() + 0.5D; this.posY = (double)blockpos.getY(); this.posZ = (double)blockpos.getZ() + 0.5D; this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.lastTickPosX = this.posX; this.lastTickPosY = this.posY; this.lastTickPosZ = this.posZ; } } super.notifyDataManagerChange(key); }
public void notifyDataManagerChange(DataParameter<?> key) { if (SCREAMING.equals(key) && this.isScreaming() && this.world.isRemote) { this.playEndermanSound(); } super.notifyDataManagerChange(key); }
public void notifyDataManagerChange(DataParameter<?> key) { if (IS_CHILD.equals(key)) { this.setChildSize(this.isChild()); } super.notifyDataManagerChange(key); }
public void notifyDataManagerChange(DataParameter<?> key) { super.notifyDataManagerChange(key); if (TARGET_ENTITY.equals(key)) { this.clientSideAttackTime = 0; this.targetedEntity = null; } }
public void notifyDataManagerChange(DataParameter<?> key) { if (PHASE.equals(key) && this.world.isRemote) { this.phaseManager.setPhase(PhaseList.getById(((Integer)this.getDataManager().get(PHASE)).intValue())); } super.notifyDataManagerChange(key); }
public void notifyDataManagerChange(DataParameter<?> key) { if (BABY.equals(key)) { this.setScaleForAge(this.isChild()); } super.notifyDataManagerChange(key); }
public void notifyDataManagerChange(DataParameter<?> key) { if (RADIUS.equals(key)) { this.setRadius(this.getRadius()); } super.notifyDataManagerChange(key); }
@Mod.EventHandler public void init(FMLPreInitializationEvent event) { conf = new Configuration(event.getSuggestedConfigurationFile()); syncConfig(); SPIN_TIME=new DataParameter<Boolean>(spinID, DataSerializers.BOOLEAN); ForgeRegistries.ENCHANTMENTS.register(ench=new EnchantmentSpin().setRegistryName("rafradek_spin", "spin")); MinecraftForge.EVENT_BUS.register(this); }