Skip to content

Commit

Permalink
Fixed + version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Oct 31, 2022
1 parent afbeffe commit f6c3241
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 43 deletions.
6 changes: 3 additions & 3 deletions .github/versions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"1.19.2": "1.5.11",
"1.19.1": "1.5.11",
"1.19": "1.5.11",
"1.19.2": "1.5.12",
"1.19.1": "1.5.12",
"1.19": "1.5.12",
"1.18.2": "1.4.5",
"1.18.1": "1.2.5",
"1.18": "1.2.5"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## mc1.19.2-1.5.12, October 31, 2022

- Fixed conflicts(crashes) with another mod
- Fixed villagers not running from the iceologers

## mc1.19.2-1.5.11, September 30, 2022

- Glare is now breedable (it can have children)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.faboslav.friendsandfoes.mixin;

import net.minecraft.block.Degradable;
import net.minecraft.block.LightningRodBlock;
import net.minecraft.block.Oxidizable;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(LightningRodBlock.class)
public abstract class LightningRodBlockDegradableMixin implements Degradable
{
@Override
public Enum<Oxidizable.OxidationLevel> getDegradationLevel() {
return Oxidizable.OxidationLevel.UNAFFECTED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,4 @@ public void randomTick(
public boolean hasRandomTicks(BlockState state) {
return Oxidizable.getIncreasedOxidationBlock(state.getBlock()).isPresent();
}

@Override
public OxidationLevel getDegradationLevel() {
return net.minecraft.block.Oxidizable.OxidationLevel.UNAFFECTED;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.faboslav.friendsandfoes.mixin;

import com.faboslav.friendsandfoes.init.FriendsAndFoesEntityTypes;
import com.google.common.collect.ImmutableMap;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.brain.sensor.VillagerHostilesSensor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(VillagerHostilesSensor.class)
public final class VillagerHostilesSensorMixin
{
private static final ImmutableMap<EntityType<?>, Float> CUSTOM_SQUARED_DISTANCES_FOR_DANGER;

static {
CUSTOM_SQUARED_DISTANCES_FOR_DANGER = ImmutableMap.<EntityType<?>, Float>builder().put(FriendsAndFoesEntityTypes.ICEOLOGER.get(), 12.0F).build();
}

@Inject(
at = @At("HEAD"),
method = "Lnet/minecraft/entity/ai/brain/sensor/VillagerHostilesSensor;isCloseEnoughForDanger(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/LivingEntity;)Z",
cancellable = true
)
private void friendsandfoes_isCloseEnoughForDanger(
LivingEntity villager,
LivingEntity target,
CallbackInfoReturnable<Boolean> cir
) {
if (CUSTOM_SQUARED_DISTANCES_FOR_DANGER.containsKey(target.getType())) {
float distance = CUSTOM_SQUARED_DISTANCES_FOR_DANGER.get(target.getType());
boolean isCloseEnoughForDanger = target.squaredDistanceTo(villager) <= (double) (distance * distance);
cir.setReturnValue(isCloseEnoughForDanger);
}
}

@Inject(
at = @At("HEAD"),
method = "Lnet/minecraft/entity/ai/brain/sensor/VillagerHostilesSensor;isHostile(Lnet/minecraft/entity/LivingEntity;)Z",
cancellable = true
)
private void friendsandfoes_isHostile(
LivingEntity entity,
CallbackInfoReturnable<Boolean> cir
) {
if (CUSTOM_SQUARED_DISTANCES_FOR_DANGER.containsKey(entity.getType())) {
cir.setReturnValue(true);
}
}
}
70 changes: 36 additions & 34 deletions common/src/main/resources/friendsandfoes-common.mixins.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
{
"required": true,
"package": "com.faboslav.friendsandfoes.mixin",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"injectors": {
"defaultRequire": 1
},
"mixins": [
"AbstractButtonBlockMixin",
"AxeItemMixin",
"BeeEntityAccessor",
"BeeEntityMixin",
"BlindTargetGoalFactory",
"ChickenEntityMixin",
"HoneycombItemMixin",
"IllusionerEntityMixin",
"LightningEntityMixin",
"LightningRodBlockMixin",
"PatrolSpawnerAccessor",
"PatrolSpawnerMixin",
"PointOfInterestTypesMixin",
"RabbitEntityMixin",
"RaidMemberMixin",
"RaidMixin",
"ServerWorldAccessor",
"SpawnRestrictionAccessor",
"StructurePoolMixin",
"VillagerTaskListProviderMixin"
],
"client": [
"IllusionerEntityRendererMixin",
"ModelPartAccessor"
],
"plugin": "com.faboslav.friendsandfoes.util.plugin.MixinExtrasPlugin"
"required": true,
"package": "com.faboslav.friendsandfoes.mixin",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"injectors": {
"defaultRequire": 1
},
"mixins": [
"AbstractButtonBlockMixin",
"AxeItemMixin",
"BeeEntityAccessor",
"BeeEntityMixin",
"BlindTargetGoalFactory",
"ChickenEntityMixin",
"HoneycombItemMixin",
"IllusionerEntityMixin",
"LightningEntityMixin",
"LightningRodBlockDegradableMixin",
"LightningRodBlockMixin",
"PatrolSpawnerAccessor",
"PatrolSpawnerMixin",
"PointOfInterestTypesMixin",
"RabbitEntityMixin",
"RaidMemberMixin",
"RaidMixin",
"ServerWorldAccessor",
"SpawnRestrictionAccessor",
"StructurePoolMixin",
"VillagerHostilesSensorMixin",
"VillagerTaskListProviderMixin"
],
"client": [
"IllusionerEntityRendererMixin",
"ModelPartAccessor"
],
"plugin": "com.faboslav.friendsandfoes.util.plugin.MixinExtrasPlugin"
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.configureondemand=false
# Mod
mod_name=Friends&Foes
mod_id=friendsandfoes
mod_version=1.5.11
mod_version=1.5.12
mod_author=Faboslav
mod_description=Adds all eliminated mobs from the minecraft mob votes along with the forgotten mobs like the Illusioner.
maven_group=com.faboslav.friendsandfoes
Expand Down

0 comments on commit f6c3241

Please sign in to comment.