Skip to content

Commit

Permalink
Fix some OCD issues
Browse files Browse the repository at this point in the history
ref #23
  • Loading branch information
kashike committed Oct 1, 2017
1 parent 4a809dc commit 231b11d
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ public static void setupSerialization() {
DataUtil.registerValueProcessor(Keys.SPAWNER_NEXT_ENTITY_TO_SPAWN, new SpawnerNextEntityToSpawnValueProcessor());
DataUtil.registerValueProcessor(Keys.SPAWNER_ENTITIES, new SpawnerEntitiesValueProcessor());
DataUtil.registerValueProcessor(Keys.AREA_EFFECT_CLOUD_COLOR, new AreaEffectCloudColorProcessor());
DataUtil.registerValueProcessor(Keys.AREA_EFFECT_CLOUD_AGE, new AReaEffectCloudAgeProcessor());
DataUtil.registerValueProcessor(Keys.AREA_EFFECT_CLOUD_AGE, new AreaEffectCloudAgeProcessor());
DataUtil.registerValueProcessor(Keys.AREA_EFFECT_CLOUD_PARTICLE_TYPE, new AreaEffectCloudParticleTypeProcessor());
DataUtil.registerValueProcessor(Keys.AREA_EFFECT_CLOUD_DURATION, new AreaEffectCloudDurationProcessor());
DataUtil.registerValueProcessor(Keys.AREA_EFFECT_CLOUD_DURATION_ON_USE, new AreaEffectCloudDurationOnUseProcessor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

import java.util.Optional;

public class AReaEffectCloudAgeProcessor extends AbstractSpongeValueProcessor<EntityAreaEffectCloud, Integer, MutableBoundedValue<Integer>> {
public class AreaEffectCloudAgeProcessor extends AbstractSpongeValueProcessor<EntityAreaEffectCloud, Integer, MutableBoundedValue<Integer>> {

public AReaEffectCloudAgeProcessor() {
public AreaEffectCloudAgeProcessor() {
super(EntityAreaEffectCloud.class, Keys.AREA_EFFECT_CLOUD_AGE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ public float getAIMoveSpeed() {
}

@Override
protected SoundEvent getFallSound(int p_184588_1_) {
return p_184588_1_ > 4 ? SoundEvents.ENTITY_PLAYER_BIG_FALL : SoundEvents.ENTITY_PLAYER_SMALL_FALL;
protected SoundEvent getFallSound(int height) {
return height > 4 ? SoundEvents.ENTITY_PLAYER_BIG_FALL : SoundEvents.ENTITY_PLAYER_SMALL_FALL;
}
@Override
public float getEyeHeight() {
Expand Down Expand Up @@ -499,7 +499,7 @@ public Packet<?>[] popQueuedPackets(@Nullable EntityPlayerMP player) {
}

@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float p_82196_2_) {
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
// Borrowed from Skeleton
// TODO Figure out how to API this out
final EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.world, this);
Expand All @@ -511,7 +511,7 @@ public void attackEntityWithRangedAttack(EntityLivingBase target, float p_82196_
// These names are wrong
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this);
entitytippedarrow.setDamage(p_82196_2_ * 2.0F + this.rand.nextGaussian() * 0.25D + this.world.getDifficulty().getDifficultyId() * 0.11F);
entitytippedarrow.setDamage(distanceFactor * 2.0F + this.rand.nextGaussian() * 0.25D + this.world.getDifficulty().getDifficultyId() * 0.11F);

if (i > 0) {
entitytippedarrow.setDamage(entitytippedarrow.getDamage() + i * 0.5D + 0.5D);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ private void printIncorrectPhaseCompletion(IPhaseState<?> prevState, IPhaseState

PrettyPrinter printer = new PrettyPrinter(60).add("Completing incorrect phase").centre().hr()
.addWrapped(50, "Sponge's tracking system is very dependent on knowing when"
+ "a change to any world takes place, however, we are attempting"
+ "to complete a \"phase\" other than the one we most recently entered."
+ "This is an error usually on Sponge's part, so a report"
+ "is required on the issue tracker on GitHub.").hr()
+ " a change to any world takes place, however, we are attempting"
+ " to complete a \"phase\" other than the one we most recently entered."
+ " This is an error usually on Sponge's part, so a report"
+ " is required on the issue tracker on GitHub.").hr()
.add("Expected to exit phase: %s", prevState)
.add("But instead found phase: %s", state)
.add("StackTrace:")
Expand All @@ -275,10 +275,10 @@ private void printEmptyStackOnCompletion() {
}
final PrettyPrinter printer = new PrettyPrinter(60).add("Unexpectedly Completing An Empty Stack").centre().hr()
.addWrapped(50, "Sponge's tracking system is very dependent on knowing when"
+ "a change to any world takes place, however, we have been told"
+ "to complete a \"phase\" without having entered any phases."
+ "This is an error usually on Sponge's part, so a report"
+ "is required on the issue tracker on GitHub.").hr()
+ " a change to any world takes place, however, we have been told"
+ " to complete a \"phase\" without having entered any phases."
+ " This is an error usually on Sponge's part, so a report"
+ " is required on the issue tracker on GitHub.").hr()
.add("StackTrace:")
.add(new Exception())
.add();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ public void attackTargetEntityWithCurrentItem(Entity targetEntity) {
final DamageFunction sweapingFunction = DamageFunction.of(DamageModifier.builder()
.cause(Cause.of(EventContext.empty(), heldSnapshot))
.item(heldSnapshot)
.type(DamageModifierTypes.SWEAPING)
.type(DamageModifierTypes.SWEEPING)
.build(),
(incoming) -> EnchantmentHelper.getSweepingDamageRatio((EntityPlayer) (Object) this) * attackDamage);
final List<DamageFunction> sweapingFunctions = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ protected GameProfile fillProfile(GameProfile profile, boolean signed) throws Pr

Optional<GameProfile> result = this.cache.fillProfile(profile, signed);
if (result.isPresent() && result.get().isFilled()) {
GameProfile t = result.get();
GameProfile filled = result.get();

this.cache.add(t, true, (Instant) null);
this.cache.add(filled, true, (Instant) null);

return t;
return filled;
}
throw new ProfileNotFoundException("Profile: " + profile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@

import com.google.common.collect.ImmutableList;
import org.spongepowered.api.event.cause.entity.damage.DamageModifierType;
import org.spongepowered.api.event.cause.entity.damage.DamageModifierTypes;
import org.spongepowered.api.registry.AlternateCatalogRegistryModule;
import org.spongepowered.api.registry.CatalogRegistryModule;
import org.spongepowered.api.registry.util.RegisterCatalog;
import org.spongepowered.common.event.damage.SpongeDamageModifierType;

import java.util.Collection;
Expand All @@ -39,12 +38,10 @@
import java.util.Map;
import java.util.Optional;

public class DamageModifierTypeRegistryModule implements CatalogRegistryModule<DamageModifierType> {
public class DamageModifierTypeRegistryModule implements CatalogRegistryModule<DamageModifierType>, AlternateCatalogRegistryModule<DamageModifierType> {

@RegisterCatalog(DamageModifierTypes.class)
private final Map<String, DamageModifierType> modifierTypeMap = new HashMap<>();


@Override
public Optional<DamageModifierType> getById(String id) {
return Optional.ofNullable(this.modifierTypeMap.get(checkNotNull(id).toLowerCase(Locale.ENGLISH)));
Expand Down Expand Up @@ -72,6 +69,16 @@ public void registerDefaults() {
this.modifierTypeMap.put("absorption", new SpongeDamageModifierType("Absorption", "absorption"));
this.modifierTypeMap.put("critical_hit", new SpongeDamageModifierType("Critical Hit", "critical_hit"));
this.modifierTypeMap.put("attack_cooldown", new SpongeDamageModifierType("Attack Cooldown", "attack_cooldown"));
this.modifierTypeMap.put("sweaping", new SpongeDamageModifierType("Sweaping", "sweaping"));
final DamageModifierType sweeping = new SpongeDamageModifierType("Sweeping", "sweeping");
this.modifierTypeMap.put("sweeping", sweeping);
this.modifierTypeMap.put("sweaping", sweeping); // TODO: remove
}

// TODO: replace with @RegisterCatalog on the field - only needed until DamageModifierTypes#SWEAPING is removed
@Override
public Map<String, DamageModifierType> provideCatalogMap() {
final Map<String, DamageModifierType> map = new HashMap<>(this.modifierTypeMap);
map.remove("sweaping"); // do not remap
return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private SourcePaginations getPaginationStateForPlayer(Player source, boolean cre
return this.playerActivePaginations.get(source.getUniqueId(), k -> create ? new SourcePaginations() : null);
}

private CommandSpec buildPaginationCommand(){
private CommandSpec buildPaginationCommand() {

final ActivePaginationCommandElement paginationElement = new ActivePaginationCommandElement(t("pagination-id"));

Expand Down

0 comments on commit 231b11d

Please sign in to comment.