Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Sep 26, 2023
2 parents 3129908 + 98de6f4 commit 9af9c74
Show file tree
Hide file tree
Showing 49 changed files with 137 additions and 1,289 deletions.
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ body:
attributes:
label: 'Minecraft version information'
description: 'Please provide the exact minecraft version that you are using.'
placeholder: 'Example: 1.18-pre5'
placeholder: 'Example: 1.19.2'
validations:
required: true
- type: dropdown
Expand All @@ -25,8 +25,9 @@ body:
description: 'Please choose the mod loader that you are using.'
options:
- Fabric
- Forge
- Quilt
- Forge
- NeoForge
validations:
required: true
- type: input
Expand Down
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/crash_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ body:
attributes:
label: 'Minecraft version information'
description: 'Please provide the exact minecraft version that you are using.'
placeholder: 'Example: 1.18-pre5'
placeholder: 'Example: 1.19.2'
validations:
required: true
- type: dropdown
Expand All @@ -25,8 +25,9 @@ body:
description: 'Please choose the mod loader that you are using.'
options:
- Fabric
- Forge
- Quilt
- Forge
- NeoForge
validations:
required: true
- type: input
Expand Down
16 changes: 8 additions & 8 deletions .github/versions.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"1.20.1": "1.9.5",
"1.20": "1.9.5",
"1.19.4": "1.8.7",
"1.19.3": "1.8.7",
"1.19.2": "1.8.7",
"1.19.1": "1.8.7",
"1.19": "1.8.7",
"1.18.2": "1.4.7",
"1.20.1": "1.9.6",
"1.20": "1.9.6",
"1.19.4": "1.8.8",
"1.19.3": "1.8.8",
"1.19.2": "1.8.8",
"1.19.1": "1.8.8",
"1.19": "1.8.8",
"1.18.2": "1.4.8",
"1.18.1": "1.2.5",
"1.18": "1.2.5"
}
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
version-type: ${{ env.VERSION_TYPE }}
loaders: ${{ env.FABRIC_LOADERS }}
game-versions: ${{ env.GAME_VERSIONS }}
name: Friends&Foes ${{ github.ref_name }} (Fabric)
name: Friends&Foes ${{ github.ref_name }} (Fabric/Quilt)
dependencies: ${{ env.FABRIC_DEPENDENCIES }}
java: ${{ env.JAVA_VERSIONS }}

Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
version-type: ${{ env.VERSION_TYPE }}
loaders: ${{ env.FABRIC_LOADERS }}
game-versions: ${{ env.GAME_VERSIONS }}
name: Friends&Foes ${{ github.ref_name }} (Fabric)
name: Friends&Foes ${{ github.ref_name }} (Fabric/Quilt)
version: fabric-${{ github.ref_name }}
dependencies: ${{ env.FABRIC_DEPENDENCIES }}
java: ${{ env.JAVA_VERSIONS }}
Expand Down Expand Up @@ -189,7 +189,7 @@ jobs:
version-type: ${{ env.VERSION_TYPE }}
loaders: ${{ env.FORGE_LOADERS }}
game-versions: ${{ env.GAME_VERSIONS }}
name: Friends&Foes ${{ github.ref_name }} (Forge)
name: Friends&Foes ${{ github.ref_name }} (Forge/NeoForge)
java: ${{ env.JAVA_VERSIONS }}

retry-attempts: ${{ env.RETRY_ATTEMPTS }}
Expand Down Expand Up @@ -220,7 +220,7 @@ jobs:
version-type: ${{ env.VERSION_TYPE }}
loaders: ${{ env.FORGE_LOADERS }}
game-versions: ${{ env.GAME_VERSIONS }}
name: Friends&Foes ${{ github.ref_name }} (Forge)
name: Friends&Foes ${{ github.ref_name }} (Forge/NeoForge)
version: forge-${{ github.ref_name }}
java: ${{ env.JAVA_VERSIONS }}
retry-attempts: ${{ env.RETRY_ATTEMPTS }}
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ You can check [wiki] for a detailed overview of implemented features. Also feel
- [Modrinth (Fabric)]
- [CurseForge (Forge)]
- [Modrinth (Forge)]
- [CurseForge (Quilt)]
- [Modrinth (Quilt)]
- [Discord]

## Support
Expand Down Expand Up @@ -52,10 +50,6 @@ This mod would not exist in the state as it is without the following people:

[Modrinth (Forge)]: https://modrinth.com/mod/friends-and-foes-forge

[CurseForge (Quilt)]: https://www.curseforge.com/minecraft/mc-mods/friends-and-foes-quilt

[Modrinth (Quilt)]: https://modrinth.com/mod/friends-and-foes-quilt

[Discord]: https://discord.com/invite/QGwFvvMQCn

[Patreon]: https://www.patreon.com/Faboslav
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}")

implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:${rootProject.mixin_extras_version}"))
implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${rootProject.mixin_extras_version}"))

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.faboslav.friendsandfoes.init.FriendsAndFoesSoundEvents;
import com.faboslav.friendsandfoes.mixin.LimbAnimatorAccessor;
import com.faboslav.friendsandfoes.util.ModelAnimationHelper;
import com.faboslav.friendsandfoes.util.RandomGenerator;
import net.minecraft.block.BlockState;
import net.minecraft.block.Oxidizable;
import net.minecraft.entity.*;
Expand Down Expand Up @@ -148,10 +147,10 @@ protected void initDataTracker() {
this.dataTracker.startTracking(STRUCT_BY_LIGHTNING_TICKS, 0);
this.dataTracker.startTracking(IS_WAXED, false);
this.dataTracker.startTracking(IS_PRESSING_BUTTON, false);
this.dataTracker.startTracking(TICKS_UNTIL_CAN_PRESS_BUTTON, RandomGenerator.generateInt(MIN_TICKS_UNTIL_CAN_PRESS_BUTTON, MIN_TICKS_UNTIL_CAN_PRESS_BUTTON + MIN_TICKS_UNTIL_CAN_PRESS_BUTTON));
this.dataTracker.startTracking(TICKS_UNTIL_CAN_PRESS_BUTTON, this.getRandom().nextBetween(MIN_TICKS_UNTIL_CAN_PRESS_BUTTON, MIN_TICKS_UNTIL_CAN_PRESS_BUTTON + MIN_TICKS_UNTIL_CAN_PRESS_BUTTON));
this.dataTracker.startTracking(IS_SPINNING_HEAD, false);
this.dataTracker.startTracking(IS_MOVING, false);
this.dataTracker.startTracking(TICKS_UNTIL_NEXT_HEAD_SPIN, RandomGenerator.generateInt(MIN_TICKS_UNTIL_NEXT_HEAD_SPIN, MAX_TICKS_UNTIL_NEXT_HEAD_SPIN));
this.dataTracker.startTracking(TICKS_UNTIL_NEXT_HEAD_SPIN, this.getRandom().nextBetween(MIN_TICKS_UNTIL_NEXT_HEAD_SPIN, MAX_TICKS_UNTIL_NEXT_HEAD_SPIN));
this.dataTracker.startTracking(BUTTON_PRESS_ANIMATION_PROGRESS, 0.0F);
this.dataTracker.startTracking(LAST_BUTTON_PRESS_ANIMATION_PROGRESS, 0.0F);
this.dataTracker.startTracking(HEAD_SPIN_ANIMATION_PROGRESS, 0.0F);
Expand Down Expand Up @@ -444,7 +443,7 @@ public void tick() {
if (this.isStructByLightning() && this.getEntityWorld().isClient() == false) {
this.setStructByLightningTicks(this.getStructByLightningTicks() - 1);

if (RandomGenerator.generateRandomFloat() < SPARK_CHANCE) {
if (this.getRandom().nextFloat() < SPARK_CHANCE) {
for (int i = 0; i < 7; i++) {
((ServerWorld) this.getWorld()).spawnParticles(
ParticleTypes.ELECTRIC_SPARK,
Expand Down Expand Up @@ -588,7 +587,7 @@ public void handleOxidationIncrease() {
return;
}

if (RandomGenerator.generateRandomFloat() < OXIDATION_CHANCE) {
if (this.getRandom().nextFloat() < OXIDATION_CHANCE) {
int degradedOxidationLevelOrdinal = getOxidationLevel().ordinal() + 1;
Oxidizable.OxidationLevel[] OxidationLevels = Oxidizable.OxidationLevel.values();
this.setOxidationLevel(OxidationLevels[degradedOxidationLevelOrdinal]);
Expand Down Expand Up @@ -626,7 +625,7 @@ public int getStructByLightningTicks() {
}

public void refreshStructByLightningTicks() {
this.setStructByLightningTicks(RandomGenerator.generateInt(MIN_STRUCT_BY_LIGHTNING_TICKS, MAX_STRUCT_BY_LIGHTNING_TICKS));
this.setStructByLightningTicks(this.getRandom().nextBetween(MIN_STRUCT_BY_LIGHTNING_TICKS, MAX_STRUCT_BY_LIGHTNING_TICKS));
}

public boolean isStructByLightning() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ public void setTargetEyesPositionOffset(float xEyePositionOffset, float yEyePosi
private void updateTargetEyesPositionOffset() {
if (
this.age % MIN_EYE_ANIMATION_TICK_AMOUNT != 0
|| RandomGenerator.generateInt(0, 2) != 0
|| this.getRandom().nextBetween(0, 2) != 0
) {
return;
}

this.setTargetEyesPositionOffset(
RandomGenerator.generateFloat(-0.5F, 0.5F),
RandomGenerator.generateFloat(-0.4F, 0.4F)
-0.5F + this.getRandom().nextFloat() * (0.5F - -0.5F),
-0.4F + this.getRandom().nextFloat() * (0.4F - -0.4F)
);
}

Expand Down Expand Up @@ -637,7 +637,7 @@ public void setTicksUntilCanFindDarkSpot(int ticksUntilCanFindDarkSpot) {
}

public int generateRandomTicksUntilCanFindDarkSpot() {
return RandomGenerator.generateInt(
return this.getRandom().nextBetween(
MIN_TICKS_UNTIL_CAN_FIND_DARK_SPOT,
MAX_TICKS_UNTIL_CAN_FIND_DARK_SPOT
);
Expand All @@ -652,7 +652,7 @@ public void setTicksUntilCanEatGlowBerries(int ticksUntilCanEatGlowBerries) {
}

public int generateRandomTicksUntilCanEatGlowBerries() {
return RandomGenerator.generateInt(
return this.getRandom().nextBetween(
MIN_TICKS_UNTIL_CAN_EAT_GLOW_BERRIES,
MAX_TICKS_UNTIL_CAN_EAT_GLOW_BERRIES
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected void initDataTracker() {
this.dataTracker.startTracking(STORED_EXPERIENCE_POINTS, 0);
this.dataTracker.startTracking(IS_MOVING, false);
this.dataTracker.startTracking(IS_BURROWED_DOWN, false);
this.dataTracker.startTracking(TICKS_UNTIL_NEXT_BURROWING_DOWN, RandomGenerator.generateInt(MIN_TICKS_UNTIL_NEXT_BURROWING, MAX_TICKS_UNTIL_NEXT_BURROWING));
this.dataTracker.startTracking(TICKS_UNTIL_NEXT_BURROWING_DOWN, this.getRandom().nextBetween(MIN_TICKS_UNTIL_NEXT_BURROWING, MAX_TICKS_UNTIL_NEXT_BURROWING));
this.dataTracker.startTracking(BURROWING_DOWN_ANIMATION_PROGRESS, 0.0F);
}

Expand Down Expand Up @@ -435,7 +435,7 @@ public void setAngerTime(int angerTime) {
}

public void chooseRandomAngerTime() {
int angerTime = RandomGenerator.generateInt(400, 1000);
int angerTime = this.getRandom().nextBetween(400, 1000);
this.setAngerTime(angerTime);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.faboslav.friendsandfoes.init.FriendsAndFoesBlocks;
import com.faboslav.friendsandfoes.init.FriendsAndFoesEntityTypes;
import com.faboslav.friendsandfoes.init.FriendsAndFoesSoundEvents;
import com.faboslav.friendsandfoes.util.RandomGenerator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
Expand Down Expand Up @@ -201,7 +200,7 @@ public MoobloomEntity createChild(
PassiveEntity entity
) {
MoobloomVariant moobloomVariant = this.getVariant();
if (RandomGenerator.generateInt(0, 1) == 0) {
if (this.getRandom().nextBetween(0, 1) == 0) {
moobloomVariant = ((MoobloomEntity) entity).getVariant();
}

Expand Down Expand Up @@ -234,7 +233,7 @@ public void tickMovement() {

if (MoobloomVariants.getNumberOfVariants() == 1) {
// 40% chance buttercup, 40% chance dandelion, 20% chance sunflower
int flowerChance = RandomGenerator.generateInt(1, 100);
int flowerChance = this.getRandom().nextBetween(1, 100);

if (flowerChance >= 0 && flowerChance < 40) {
this.getWorld().setBlockState(this.getBlockPos(), FriendsAndFoesBlocks.BUTTERCUP.get().getDefaultState());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private SoundEvent getRepairSound() {
}

private void playRepairSound() {
this.playSound(this.getRepairSound(), 1.0F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
this.playSound(this.getRepairSound(), 1.0F, 1.0F + (this.getRandom().nextFloat() - this.getRandom().nextFloat()) * 0.2F);
}

public SoundEvent getWakeSound() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ public void tickMovement() {
}

if (this.getWorld().isClient()) {
if (this.random.nextInt(24) == 0 && !this.isSilent()) {
this.getWorld().playSound(this.getX() + 0.5, this.getY() + 0.5, this.getZ() + 0.5, SoundEvents.ENTITY_BLAZE_BURN, this.getSoundCategory(), 1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F, false);
if (this.getRandom().nextInt(24) == 0 && !this.isSilent()) {
this.getWorld().playSound(this.getX() + 0.5, this.getY() + 0.5, this.getZ() + 0.5, SoundEvents.ENTITY_BLAZE_BURN, this.getSoundCategory(), 1.0F + this.getRandom().nextFloat(), this.getRandom().nextFloat() * 0.7F + 0.3F, false);
}

for (int i = 0; i < 2; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private SoundEvent getImpactSound() {

private void playImpactSound() {
SoundEvent soundEvent = this.getImpactSound();
this.playSound(soundEvent, 1.0F, RandomGenerator.generateFloat(0.95F, 1.05F));
this.playSound(soundEvent, 1.0F, 0.95F + RandomGenerator.generateFloat(0.95F, 1.05F));
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.faboslav.friendsandfoes.entity.WildfireEntity;
import com.faboslav.friendsandfoes.entity.ai.brain.WildfireBrain;
import com.faboslav.friendsandfoes.init.FriendsAndFoesMemoryModuleTypes;
import com.faboslav.friendsandfoes.util.RandomGenerator;
import com.google.common.collect.ImmutableMap;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
Expand Down Expand Up @@ -82,7 +81,7 @@ protected void keepRunning(ServerWorld world, WildfireEntity wildfire, long time
LookTargetUtil.lookAt(wildfire, this.attackTarget);

ServerWorld serverWorld = (ServerWorld) wildfire.getWorld();
int blazesToBeSummoned = Math.max(0, RandomGenerator.generateInt(MIN_BLAZES_TO_BE_SUMMONED, MAX_BLAZES_TO_BE_SUMMONED) - wildfire.getSummonedBlazesCount());
int blazesToBeSummoned = Math.max(0, wildfire.getRandom().nextBetween(MIN_BLAZES_TO_BE_SUMMONED, MAX_BLAZES_TO_BE_SUMMONED) - wildfire.getSummonedBlazesCount());

if (blazesToBeSummoned > 0) {
wildfire.playSummonBlazeSound();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.faboslav.friendsandfoes.entity.MoobloomEntity;
import com.faboslav.friendsandfoes.mixin.BeeEntityAccessor;
import com.faboslav.friendsandfoes.util.RandomGenerator;
import net.minecraft.entity.ai.TargetPredicate;
import net.minecraft.entity.ai.goal.Goal;
import net.minecraft.entity.passive.BeeEntity;
Expand Down Expand Up @@ -46,7 +45,7 @@ public boolean canStart() {
return false;
} else if (this.beeEntity.getWorld().isRaining()) {
return false;
} else if (RandomGenerator.generateRandomFloat() < 0.5F) {
} else if (this.beeEntity.getRandom().nextFloat() < 0.5F) {
return false;
} else if (this.beeEntity.pollinateGoal.isRunning()) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.faboslav.friendsandfoes.block.CopperButtonBlock;
import com.faboslav.friendsandfoes.entity.CopperGolemEntity;
import com.faboslav.friendsandfoes.tag.FriendsAndFoesTags;
import com.faboslav.friendsandfoes.util.RandomGenerator;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalFacingBlock;
import net.minecraft.entity.ai.goal.Goal;
Expand Down Expand Up @@ -102,8 +101,8 @@ public void start() {
this.copperButtonWasSuccessfullyPressed = false;
int minIdleTicks = 20;
int maxIdleTicks = 40;
this.idleTicksBeforeButtonPress = RandomGenerator.generateInt(minIdleTicks, maxIdleTicks);
this.idleTicksAfterButtonPress = RandomGenerator.generateInt(minIdleTicks, maxIdleTicks);
this.idleTicksBeforeButtonPress = this.copperGolem.getRandom().nextBetween(minIdleTicks, maxIdleTicks);
this.idleTicksAfterButtonPress = this.copperGolem.getRandom().nextBetween(minIdleTicks, maxIdleTicks);
}

@Override
Expand All @@ -124,7 +123,7 @@ public void stop() {
}

int maxCooldownTicks = minCooldownTicks + CopperGolemEntity.MIN_TICKS_UNTIL_CAN_PRESS_BUTTON;
int cooldown = RandomGenerator.generateInt(minCooldownTicks, maxCooldownTicks);
int cooldown = this.copperGolem.getRandom().nextBetween(minCooldownTicks, maxCooldownTicks);
this.copperGolem.setTicksUntilCanPressButton(cooldown);
}

Expand Down Expand Up @@ -258,7 +257,7 @@ private BlockPos getRandomCopperButtonToPress(ArrayList<BlockPos> copperButtons)
return null;
}

int randomCopperButtonIndex = RandomGenerator.generateInt(0, copperButtonsCount - 1);
int randomCopperButtonIndex = this.copperGolem.getRandom().nextBetween(0, copperButtonsCount - 1);

return copperButtons.get(randomCopperButtonIndex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.faboslav.friendsandfoes.entity.CopperGolemEntity;
import com.faboslav.friendsandfoes.init.FriendsAndFoesSoundEvents;
import com.faboslav.friendsandfoes.util.RandomGenerator;
import net.minecraft.entity.ai.goal.Goal;

public final class CopperGolemSpinHeadGoal extends Goal
Expand All @@ -22,7 +21,7 @@ public boolean canStart() {
return false;
} else if (this.copperGolem.pressButtonGoal.isRunning()) {
return false;
} else if (RandomGenerator.generateRandomFloat() < 0.95) {
} else if (this.copperGolem.getRandom().nextFloat() < 0.95) {
return false;
}

Expand All @@ -48,7 +47,7 @@ public void start() {
public void stop() {
this.copperGolem.setIsSpinningHead(false);
this.copperGolem.setTicksUntilNextHeadSpin(
RandomGenerator.generateInt(
this.copperGolem.getRandom().nextBetween(
CopperGolemEntity.MIN_TICKS_UNTIL_NEXT_HEAD_SPIN,
CopperGolemEntity.MAX_TICKS_UNTIL_NEXT_HEAD_SPIN
)
Expand Down
Loading

0 comments on commit 9af9c74

Please sign in to comment.