Skip to content

Commit

Permalink
Merge pull request #114 from Faboslav/feature/1.20
Browse files Browse the repository at this point in the history
1.20
  • Loading branch information
Faboslav authored Jun 8, 2023
2 parents bd417f9 + 9f88558 commit ddb2269
Show file tree
Hide file tree
Showing 62 changed files with 379 additions and 229 deletions.
11 changes: 6 additions & 5 deletions .github/versions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"1.19.4": "1.8.1",
"1.19.3": "1.8.1",
"1.19.2": "1.8.1",
"1.19.1": "1.8.1",
"1.19": "1.8.1",
"1.20": "1.9.0",
"1.19.4": "1.8.2",
"1.19.3": "1.8.2",
"1.19.2": "1.8.2",
"1.19.1": "1.8.2",
"1.19": "1.8.2",
"1.18.2": "1.4.7",
"1.18.1": "1.2.5",
"1.18": "1.2.5"
Expand Down
86 changes: 1 addition & 85 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ env:
Java 17
Java 18
GAME_VERSIONS: |
1.19.4
1.20
FABRIC_DEPENDENCIES: |
fabric-api | depends | *
QUILT_DEPENDENCIES: |
qsl | depends | *
RETRY_ATTEMPTS: 3
RELAY_DELAY: 10000
VERSION_RESOLVER: latest
Expand Down Expand Up @@ -49,7 +47,6 @@ jobs:
path: |
fabric/build/libs/friendsandfoes-fabric-${{ github.ref_name }}.jar
forge/build/libs/friendsandfoes-forge-${{ github.ref_name }}.jar
quilt/build/libs/friendsandfoes-quilt-${{ github.ref_name }}.jar
LICENSE.txt
publish-license-to-release:
Expand Down Expand Up @@ -226,85 +223,4 @@ jobs:
java: ${{ env.JAVA_VERSIONS }}
retry-attempts: ${{ env.RETRY_ATTEMPTS }}
retry-delay: ${{ env.RETRY_DELAY }}
version-resolver: ${{ env.VERSION_RESOLVER }}


publish-quilt-to-github:
needs: build
runs-on: ubuntu-latest
name: "Publish Quilt to GitHub"
timeout-minutes: 30

steps:
- name: "Download artifacts"
uses: actions/download-artifact@v3
with:
name: "friends-and-foes"

- name: "Publish Quilt to GitHub"
uses: AButler/[email protected]
with:
files: quilt/build/libs/friendsandfoes-quilt-${{ github.ref_name }}.jar
repo-token: ${{ secrets.GITHUB_TOKEN }}

publish-quilt-to-curseforge:
needs: build
runs-on: ubuntu-latest
name: "Publish Quilt to CurseForge"
timeout-minutes: 30

steps:
- name: "Download artifacts"
uses: actions/download-artifact@v3
with:
name: "friends-and-foes"

- name: "Publish Quilt to CurseForge"
uses: Kir-Antipov/[email protected]
with:
curseforge-id: 628248
curseforge-token: ${{ secrets.CURSEFORGE_RELEASE_TOKEN }}

files-primary: quilt/build/libs/friendsandfoes-quilt-${{ github.ref_name }}.jar
version-type: ${{ env.VERSION_TYPE }}
loaders: quilt
game-versions: ${{ env.GAME_VERSIONS }}
name: Friends&Foes ${{ github.ref_name }} (Quilt)
dependencies: ${{ env.QUILT_DEPENDENCIES }}
java: ${{ env.JAVA_VERSIONS }}

retry-attempts: ${{ env.RETRY_ATTEMPTS }}
retry-delay: ${{ env.RETRY_DELAY }}
version-resolver: ${{ env.VERSION_RESOLVER }}

publish-quilt-to-modrinth:
needs: build
runs-on: ubuntu-latest
name: "Publish Quilt to Modrinth"
timeout-minutes: 30

steps:
- name: "Download artifacts"
uses: actions/download-artifact@v3
with:
name: "friends-and-foes"

- name: "Publish Quilt to Modrinth"
uses: Kir-Antipov/[email protected]
with:
modrinth-id: NxP9xmhw
modrinth-featured: true
modrinth-unfeature-mode: version-intersection
modrinth-token: ${{ secrets.MODRINTH_RELEASE_TOKEN }}

files-primary: quilt/build/libs/friendsandfoes-quilt-${{ github.ref_name }}.jar
version-type: ${{ env.VERSION_TYPE }}
loaders: quilt
game-versions: ${{ env.GAME_VERSIONS }}
name: Friends&Foes ${{ github.ref_name }} (Quilt)
version: quilt-${{ github.ref_name }}
dependencies: ${{ env.QUILT_DEPENDENCIES }}
java: ${{ env.JAVA_VERSIONS }}
retry-attempts: ${{ env.RETRY_ATTEMPTS }}
retry-delay: ${{ env.RETRY_DELAY }}
version-resolver: ${{ env.VERSION_RESOLVER }}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## mc1.20-1.9.0, June 8, 2023

- Ported to 1.20
- Added cherry beehive

## mc1.19.4-1.8.2, May 17, 2023

- Added Totem of Illusion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
import net.minecraft.predicate.entity.AdvancementEntityPredicateSerializer;
import net.minecraft.predicate.entity.EntityPredicate;
import net.minecraft.predicate.entity.EntityPredicate.Extended;
import net.minecraft.predicate.entity.LootContextPredicate;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;

Expand All @@ -26,10 +26,10 @@ public Identifier getId() {

public ActivateZombieHorseTrapCriterion.Conditions conditionsFromJson(
JsonObject jsonObject,
EntityPredicate.Extended extended,
LootContextPredicate extended,
AdvancementEntityPredicateDeserializer advancementEntityPredicateDeserializer
) {
EntityPredicate.Extended extended2 = Extended.getInJson(jsonObject, "lightning", advancementEntityPredicateDeserializer);
LootContextPredicate extended2 = EntityPredicate.contextPredicateFromJson(jsonObject, "lightning", advancementEntityPredicateDeserializer);

return new ActivateZombieHorseTrapCriterion.Conditions(extended, extended2);
}
Expand All @@ -44,15 +44,15 @@ public void trigger(ServerPlayerEntity player, LightningEntity lightning) {

public static class Conditions extends AbstractCriterionConditions
{
private final EntityPredicate.Extended lightning;
private final LootContextPredicate lightning;

public Conditions(EntityPredicate.Extended player, EntityPredicate.Extended lightning) {
public Conditions(LootContextPredicate player, LootContextPredicate lightning) {
super(ActivateZombieHorseTrapCriterion.ID, player);
this.lightning = lightning;
}

public static ActivateZombieHorseTrapCriterion.Conditions create(EntityPredicate lightning) {
return new ActivateZombieHorseTrapCriterion.Conditions(Extended.EMPTY, Extended.ofLegacy(lightning));
return new ActivateZombieHorseTrapCriterion.Conditions(LootContextPredicate.EMPTY, EntityPredicate.asLootContextPredicate(lightning));
}

public boolean test(LootContext lightning) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
import net.minecraft.predicate.entity.AdvancementEntityPredicateSerializer;
import net.minecraft.predicate.entity.EntityPredicate;
import net.minecraft.predicate.entity.EntityPredicate.Extended;
import net.minecraft.predicate.entity.LootContextPredicate;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;

public final class TameGlareCriterion extends AbstractCriterion<TameGlareCriterion.Conditions>
{
public class TameGlareCriterion extends AbstractCriterion<TameGlareCriterion.Conditions> {
static final Identifier ID = FriendsAndFoes.makeID("tame_glare");

public TameGlareCriterion() {
Expand All @@ -24,13 +23,9 @@ public Identifier getId() {
return ID;
}

public Conditions conditionsFromJson(
JsonObject jsonObject,
Extended extended,
AdvancementEntityPredicateDeserializer advancementEntityPredicateDeserializer
) {
Extended extended2 = Extended.getInJson(jsonObject, "entity", advancementEntityPredicateDeserializer);
return new Conditions(extended, extended2);
public TameGlareCriterion.Conditions conditionsFromJson(JsonObject jsonObject, LootContextPredicate lootContextPredicate, AdvancementEntityPredicateDeserializer advancementEntityPredicateDeserializer) {
LootContextPredicate lootContextPredicate2 = EntityPredicate.contextPredicateFromJson(jsonObject, "entity", advancementEntityPredicateDeserializer);
return new TameGlareCriterion.Conditions(lootContextPredicate, lootContextPredicate2);
}

public void trigger(ServerPlayerEntity player, GlareEntity entity) {
Expand All @@ -40,21 +35,20 @@ public void trigger(ServerPlayerEntity player, GlareEntity entity) {
});
}

public static class Conditions extends AbstractCriterionConditions
{
private final Extended entity;
public static class Conditions extends AbstractCriterionConditions {
private final LootContextPredicate entity;

public Conditions(Extended player, Extended entity) {
public Conditions(LootContextPredicate player, LootContextPredicate entity) {
super(TameGlareCriterion.ID, player);
this.entity = entity;
}

public static Conditions any() {
return new Conditions(Extended.EMPTY, Extended.EMPTY);
public static TameGlareCriterion.Conditions any() {
return new TameGlareCriterion.Conditions(LootContextPredicate.EMPTY, LootContextPredicate.EMPTY);
}

public static Conditions create(EntityPredicate entity) {
return new Conditions(Extended.EMPTY, Extended.ofLegacy(entity));
public static TameGlareCriterion.Conditions create(EntityPredicate entity) {
return new TameGlareCriterion.Conditions(LootContextPredicate.EMPTY, EntityPredicate.asLootContextPredicate(entity));
}

public boolean matches(LootContext tamedEntityContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void setPosition(
ModelPart modelPart,
Vector3f position
) {
modelPart.setPivot((float) position.x(), (float) position.y(), (float) position.z());
modelPart.setPivot(position.x(), position.y(), position.z());
}

public static void setXRotation(ModelPart modelPart, float x) {
Expand All @@ -43,6 +43,6 @@ public static void setRotation(
ModelPart modelPart,
Vector3f rotation
) {
modelPart.setAngles((float) rotation.x(), (float) rotation.y(), (float) rotation.z());
modelPart.setAngles(rotation.x(), rotation.y(), rotation.z());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public PlayerIllusionEntityRenderer(EntityRendererFactory.Context ctx) {

public PlayerIllusionEntityRenderer(EntityRendererFactory.Context ctx, boolean slim) {
super(ctx, new PlayerIllusionEntityModel<>(ctx.getPart(slim ? EntityModelLayers.PLAYER_SLIM:EntityModelLayers.PLAYER), slim), 0.5F);
this.addFeature(new ArmorFeatureRenderer(this, new ArmorEntityModel(ctx.getPart(slim ? EntityModelLayers.PLAYER_SLIM_INNER_ARMOR : EntityModelLayers.PLAYER_INNER_ARMOR)), new ArmorEntityModel(ctx.getPart(slim ? EntityModelLayers.PLAYER_SLIM_OUTER_ARMOR : EntityModelLayers.PLAYER_OUTER_ARMOR)), ctx.getModelManager()));
this.addFeature(new ArmorFeatureRenderer(this, new ArmorEntityModel(ctx.getPart(slim ? EntityModelLayers.PLAYER_SLIM_INNER_ARMOR:EntityModelLayers.PLAYER_INNER_ARMOR)), new ArmorEntityModel(ctx.getPart(slim ? EntityModelLayers.PLAYER_SLIM_OUTER_ARMOR:EntityModelLayers.PLAYER_OUTER_ARMOR)), ctx.getModelManager()));
this.addFeature(new PlayerHeldItemFeatureRenderer(this, ctx.getHeldItemRenderer()));
this.addFeature(new StuckArrowsFeatureRenderer<>(ctx, this));
this.addFeature(new Deadmau5FeatureRenderer(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ protected void playStepSound(
) {
if (
this.isOxidized()
|| state.getMaterial().isLiquid()
|| state.isLiquid()
) {
return;
}
Expand Down Expand Up @@ -440,7 +440,7 @@ public void tick() {

if (RandomGenerator.generateRandomFloat() < SPARK_CHANCE) {
for (int i = 0; i < 7; i++) {
((ServerWorld) world).spawnParticles(
((ServerWorld) this.getWorld()).spawnParticles(
ParticleTypes.ELECTRIC_SPARK,
this.getParticleX(0.35D),
this.getRandomBodyY() + 0.25D,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ protected void playStepSound(
) {
if (
this.isInSleepingPose()
|| state.getMaterial().isLiquid()
|| state.isLiquid()
) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@ public void readCustomDataFromNbt(NbtCompound nbt) {

@Override
protected void playStepSound(BlockPos pos, BlockState state) {
if (state.getMaterial().isLiquid()) {
if (state.isLiquid()) {
return;
}

BlockState blockState = this.getWorld().getBlockState(pos.up());
BlockSoundGroup blockSoundGroup = blockState.isIn(BlockTags.INSIDE_STEP_SOUND_BLOCKS) ? blockState.getSoundGroup():state.getSoundGroup();
this.playSound(FriendsAndFoesSoundEvents.ENTITY_WILDFIRE_STEP.get(), blockSoundGroup.getVolume() * 0.15F, blockSoundGroup.getPitch());


}

public SoundEvent getShootSound() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,12 @@ public static void setSummonBlazeCooldown(WildfireEntity wildfire) {
}

public static boolean shouldRunAway(WildfireEntity wildfire) {
if (
wildfire.getBrain().getOptionalRegisteredMemory(FriendsAndFoesMemoryModuleTypes.WILDFIRE_BARRAGE_ATTACK_COOLDOWN.get()).isPresent()
&& wildfire.getBrain().getOptionalRegisteredMemory(FriendsAndFoesMemoryModuleTypes.WILDFIRE_SHOCKWAVE_ATTACK_COOLDOWN.get()).isPresent()
&& (
wildfire.getBrain().getOptionalRegisteredMemory(FriendsAndFoesMemoryModuleTypes.WILDFIRE_SUMMON_BLAZE_COOLDOWN.get()).isPresent()
|| wildfire.getSummonedBlazesCount() == WildfireEntity.MAXIMUM_SUMMONED_BLAZES_COUNT
)
) {
return true;
}

return false;
return wildfire.getBrain().getOptionalRegisteredMemory(FriendsAndFoesMemoryModuleTypes.WILDFIRE_BARRAGE_ATTACK_COOLDOWN.get()).isPresent()
&& wildfire.getBrain().getOptionalRegisteredMemory(FriendsAndFoesMemoryModuleTypes.WILDFIRE_SHOCKWAVE_ATTACK_COOLDOWN.get()).isPresent()
&& (
wildfire.getBrain().getOptionalRegisteredMemory(FriendsAndFoesMemoryModuleTypes.WILDFIRE_SUMMON_BLAZE_COOLDOWN.get()).isPresent()
|| wildfire.getSummonedBlazesCount() == WildfireEntity.MAXIMUM_SUMMONED_BLAZES_COUNT
);
}

public static void onCooldown(WildfireEntity wildfire) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected void keepRunning(ServerWorld world, WildfireEntity wildfire, long time
wildfire.getBodyY(0.5) + 0.5,
shieldDebris.getZ()
);
wildfire.world.spawnEntity(shieldDebris);
wildfire.getWorld().spawnEntity(shieldDebris);
this.shieldDebrisFired++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public boolean canStart() {
return false;
} else if (this.beeEntity.hasNectar()) {
return false;
} else if (this.beeEntity.world.isRaining()) {
} else if (this.beeEntity.getWorld().isRaining()) {
return false;
} else if (RandomGenerator.generateRandomFloat() < 0.5F) {
return false;
Expand Down Expand Up @@ -151,7 +151,7 @@ private void pollinate() {
double d = this.beeEntity.getRandom().nextGaussian() * 0.02D;
double e = this.beeEntity.getRandom().nextGaussian() * 0.02D;
double f = this.beeEntity.getRandom().nextGaussian() * 0.02D;
((ServerWorld) this.beeEntity.world).spawnParticles(
((ServerWorld) this.beeEntity.getWorld()).spawnParticles(
ParticleTypes.HEART,
this.beeEntity.getParticleX(1.0D),
this.beeEntity.getRandomBodyY() + 0.5D,
Expand All @@ -167,7 +167,7 @@ private void pollinate() {

@Nullable
private MoobloomEntity findMoobloom() {
List<MoobloomEntity> moobloomEntities = this.beeEntity.world.getTargets(
List<MoobloomEntity> moobloomEntities = this.beeEntity.getWorld().getTargets(
MoobloomEntity.class,
VALID_MOOBLOOM_PREDICATE,
this.beeEntity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public boolean canStart() {
}

TargetPredicate withinRangePredicate = TargetPredicate.createNonAttackable().setBaseMaxDistance(this.fleeDistance).setPredicate(inclusionSelector.and(extraInclusionSelector));
this.targetEntity = this.mob.world.getClosestEntity(this.mob.world.getEntitiesByClass(this.classToFleeFrom, this.mob.getBoundingBox().expand(this.fleeDistance, 3.0D, this.fleeDistance), (livingEntity) -> {
this.targetEntity = this.mob.getWorld().getClosestEntity(this.mob.getWorld().getEntitiesByClass(this.classToFleeFrom, this.mob.getBoundingBox().expand(this.fleeDistance, 3.0D, this.fleeDistance), (livingEntity) -> {
return true;
}), withinRangePredicate, this.mob, this.mob.getX(), this.mob.getY(), this.mob.getZ());
if (this.targetEntity == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void stop() {

@Nullable
private ItemEntity getFoodItemToPickUp() {
List<ItemEntity> foodItemsToPickUp = this.glare.world.getEntitiesByClass(
List<ItemEntity> foodItemsToPickUp = this.glare.getWorld().getEntitiesByClass(
ItemEntity.class,
this.glare.getBoundingBox().expand(8.0D, 8.0D, 8.0D),
IS_PICKABLE_FOOD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public GlareFollowOwnerGoal(
boolean leavesAllowed
) {
this.glare = glare;
this.world = glare.world;
this.world = glare.getWorld();
this.speed = glare.getFastMovementSpeed();
this.navigation = glare.getNavigation();
this.minDistance = minDistance;
Expand Down
Loading

0 comments on commit ddb2269

Please sign in to comment.