Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/architectury/1.19' into architec…
Browse files Browse the repository at this point in the history
…tury/1.19
  • Loading branch information
mistersecret312 committed Jan 2, 2024
2 parents 5c9ac9a + ab92351 commit 0cc5b72
Show file tree
Hide file tree
Showing 62 changed files with 939 additions and 996 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish to Maven Repository

on:
push:
branches:
- architectury/1.19

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'

- name: Make Gradlew Executable
run: chmod +x ./gradlew

- name: Build and Publish
run: |
./gradlew publish
env:
MAVEN_REPO_USERNAME: ${{ secrets.MAVEN_REPO_USERNAME }}
MAVEN_REPO_PASSWORD: ${{ secrets.MAVEN_REPO_PASSWORD }}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ subprojects {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.mappings}")
//parchment("org.parchmentmc.data:parchment-${rootProject.mappings}")
}
}
}
Expand Down
12 changes: 8 additions & 4 deletions changelog.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<b> Version 1.19-41.0.9 </b></br>
<b> Version 1.19-43.1.0 </b></br>
<b>Changes:</b><br>
- Closes Weeping Angels Catacombs issue with other mods (#271)</br>
- Closes [Log] Mixin config weeping_angels-common.mixins.json does not specify "minVersion" property (#266)</br>
- Registered Attributes correctly</br>
<b>- Adds the ability to disable Weeping Angel item theft</b><br>
<b>- Removes all references to Kontron</b><br>
<b>- Fix weeping angels clearing the first slot on the hotbar when there's stealable items in the inventory</b><br>
<b>- Fixed Angels Teleporting non-player entities</b><br>
<b>- Fixed game crashing when a banned dimension is configurated incorrectly</b><br>
<b>- Reduced Angel Block Breaking Range</b><br>

13 changes: 10 additions & 3 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,22 @@ dependencies {




publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
mavenFabric(MavenPublication) {
artifactId = archives_base_name + "_" + project.name
from components.java
}
}

repositories {
// Add repositories to publish to here.
maven {
url = "https://maven.craig.software/repository/whocraft/"
credentials {
username = project.findProperty("MAVEN_REPO_USERNAME") ?: System.getenv("MAVEN_REPO_USERNAME") ?: ""
password = project.findProperty("MAVEN_REPO_PASSWORD") ?: System.getenv("MAVEN_REPO_PASSWORD") ?: ""
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ public class WAConfiguration {
// Behaviour
public final ForgeConfigSpec.IntValue stalkRange;
public final ForgeConfigSpec.BooleanValue blockBreaking;

public final ForgeConfigSpec.BooleanValue stealItems; // New option

// Damage
public final ForgeConfigSpec.EnumValue<HurtHelper.HurtType> hurtType;

// Teleport
public final ForgeConfigSpec.IntValue teleportRange;
public final ForgeConfigSpec.IntValue teleportChance;
public final ForgeConfigSpec.BooleanValue teleportEnabled;

public final ForgeConfigSpec.ConfigValue<List<? extends String>> bannedDimensions;

Expand All @@ -59,14 +60,14 @@ public static class Client {
}
}


public static class Spawns{
public static class Spawns {

public final ForgeConfigSpec.IntValue maxCount;
public final ForgeConfigSpec.IntValue spawnWeight;
public final ForgeConfigSpec.IntValue minCount;
public final ForgeConfigSpec.EnumValue<MobCategory> spawnType;
public Spawns(ForgeConfigSpec.Builder builder){

public Spawns(ForgeConfigSpec.Builder builder) {
builder.push("spawn");
minCount = builder.translation("config.weeping_angels.minCount").comment("The minimum amount of 'Weeping Angels' that spawn at each spawn attempt").defineInRange("minCount", 1, 1, 100);
maxCount = builder.translation("config.weeping_angels.maxCount").comment("The maximum amount of 'Weeping Angels' that spawn at each spawn attempt").defineInRange("maxCount", 4, 1, 100);
Expand All @@ -80,6 +81,7 @@ public WAConfiguration(ForgeConfigSpec.Builder builder) {
builder.push("behaviour").comment("This section determines the behaviour of the Weeping Angels - if you wish to ban a block from being interacted with by Weeping Angels, you will need to create a datapack and edit weeping_angels:no_breaking");
stalkRange = builder.translation("config.weeping_angels.stalk_range").comment("Determines the range quantum locked entities will check if the player is looking in").defineInRange("stalk_range", 65, 1, 100);
blockBreaking = builder.translation("config.weeping_angels.block_breaking").comment("If enabled alongside the mobGriefing gamerule, angels will interact with blocks that emit light").define("block_breaking", true);
stealItems = builder.translation("config.weeping_angels.steal_items").comment("Determines whether Weeping Angels can steal items from players").define("steal_items", true); // New option
builder.pop();

builder.push("damage");
Expand All @@ -89,9 +91,8 @@ public WAConfiguration(ForgeConfigSpec.Builder builder) {
builder.push("teleporting");
teleportRange = builder.translation("config.weeping_angels.teleport_range").comment("Determines the range that a player can be teleported from their current location").defineInRange("teleport_range", 400, 1, Integer.MAX_VALUE);
teleportChance = builder.translation("config.weeping_angels.teleport_chance").comment("Determines the chance a player will be teleported").defineInRange("teleport_chance", 50, 1, 100);
teleportEnabled = builder.translation("config.weeping_angels.teleport_enabled").comment("Determines whether teleportation is enabled for the Weeping Angels").define("teleport_enabled", true);
bannedDimensions = builder.translation("config.weeping_angels.banned_dimensions").comment("A list of Dimensions that angels cannot teleport players to").defineList("banned_dimensions", Lists.newArrayList(Level.END.location().toString()), String.class::isInstance);
builder.pop();

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import mc.craig.software.angels.common.WAConstants;
import mc.craig.software.angels.common.entity.angel.WeepingAngel;
import mc.craig.software.angels.util.WADamageSources;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
Expand Down Expand Up @@ -121,29 +120,25 @@ public void tick(Level level, BlockPos blockPos, BlockState blockState, Generato
}



private void dragEntitiesAround(Level level) {
for (Entity entity : level.getEntitiesOfClass(LivingEntity.class, createBoundingBox(worldPosition).inflate(32))) {

if (entity instanceof WeepingAngel weepingAngel) {
weepingAngel.setNoAi(false);
weepingAngel.setHooked(true);
}

if (entity.distanceToSqr(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()) <= 4) {
if (entity instanceof WeepingAngel weepingAngel) {

if (entity.distanceToSqr(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()) <= 4) {
weepingAngel.remove(Entity.RemovalReason.KILLED);
} else {
entity.hurt(WADamageSources.GENERATOR, 5F);
}
}

BlockPos pos = worldPosition.subtract(entity.blockPosition());
Vec3 vec = new Vec3(pos.getX(), pos.getY(), pos.getZ()).normalize();
entity.setDeltaMovement(vec.scale(0.25D));
BlockPos pos = worldPosition.subtract(entity.blockPosition());
Vec3 vec = new Vec3(pos.getX(), pos.getY(), pos.getZ()).normalize();
entity.setDeltaMovement(vec.scale(0.25D));

for (int i = 0; i < 2; ++i) {
this.level.addParticle(ParticleTypes.ELECTRIC_SPARK, entity.getRandomX(0.5D), entity.getRandomY(), entity.getRandomZ(0.5D), 0.0D, 0.0D, 0.0D);
for (int i = 0; i < 2; ++i) {
this.level.addParticle(ParticleTypes.ELECTRIC_SPARK, entity.getRandomX(0.5D), entity.getRandomY(), entity.getRandomZ(0.5D), 0.0D, 0.0D, 0.0D);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Pla
if (!pLevel.isClientSide()) {

ItemStack handItem = pPlayer.getItemInHand(pHand);
if (handItem.is(WAItems.KONTRON_INGOT.get()) && isBreakable(pLevel, pPos)) {
if (isBreakable(pLevel, pPos)) {
handItem.shrink(1);
activateFromPos(pPos, pLevel, true);
pPlayer.swing(pHand);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public class WABlocks {

public static final DeferredRegistry<Block> BLOCKS = DeferredRegistry.create(WeepingAngels.MODID, Registry.BLOCK_REGISTRY);

public static final RegistrySupplier<Block> KONTRON_ORE = register("kontron_ore", () -> new MineableBlock(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(3.0F, 3.0F)), WAItems.getCreativeTab());
public static final RegistrySupplier<Block> KONTRON_ORE_DEEPSLATE = register("deepslate_kontron_ore", () -> new MineableBlock(BlockBehaviour.Properties.copy(WABlocks.KONTRON_ORE.get()).color(MaterialColor.DEEPSLATE).strength(4.5F, 3.0F).sound(SoundType.DEEPSLATE)), WAItems.getCreativeTab());
public static final RegistrySupplier<Block> CHRONODYNE_GENERATOR = register("chronodyne_generator", () -> new GeneratorBlock(BlockBehaviour.Properties.of(Material.HEAVY_METAL, MaterialColor.COLOR_LIGHT_GREEN).sound(SoundType.METAL)), WAItems.getCreativeTab(), false);
public static final RegistrySupplier<Block> COFFIN = register("coffin", () -> new CoffinBlock(BlockBehaviour.Properties.of(Material.WOOD, MaterialColor.COLOR_BROWN).sound(SoundType.WOOD)), WAItems.getCreativeTab());
public static final RegistrySupplier<Block> STATUE = register("statue", () -> new StatueBaseBlock(BlockBehaviour.Properties.of(Material.STONE, MaterialColor.STONE).sound(SoundType.STONE)), WAItems.getCreativeTab());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.ClimbOnTopOfPowderSnowGoal;
Expand Down Expand Up @@ -99,10 +101,11 @@ public ItemStack getPickResult() {

@Override
public boolean doHurtTarget(Entity pEntity) {
if (!(pEntity instanceof Player player)) return false;
float attackDamage = (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);

// Teleporting
boolean shouldTeleport = random.nextInt(100) < WAConfiguration.CONFIG.teleportChance.get();
boolean shouldTeleport = random.nextInt(100) < WAConfiguration.CONFIG.teleportChance.get() && WAConfiguration.CONFIG.teleportEnabled.get();
if (shouldTeleport && pEntity.level instanceof ServerLevel serverLevel) {
ServerLevel chosenDimension = Teleporter.getRandomDimension(random, serverLevel);
double xCoord = getX() + random.nextInt(WAConfiguration.CONFIG.teleportRange.get());
Expand All @@ -111,14 +114,14 @@ public boolean doHurtTarget(Entity pEntity) {
for (int i = 0; i < 10; i++) {
boolean successfulTeleport = Teleporter.performTeleport(pEntity, Teleporter.getRandomDimension(random, serverLevel), xCoord, chosenDimension.getHeight(Heightmap.Types.MOTION_BLOCKING, (int) xCoord, (int) zCoord), zCoord, pEntity.getYRot(), pEntity.getXRot(), true);
if (successfulTeleport) {
player.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 1200));
return true;
}
}
return false;
}

// Theft
if (pEntity instanceof Player player) {
if(WAConfiguration.CONFIG.stealItems.get()) {
stealItems(player);
}

Expand Down Expand Up @@ -209,7 +212,7 @@ public void stealItems(Player player) {
navigator.setCanFloat(false);
navigator.setCanOpenDoors(true);
navigator.setAvoidSun(false);
navigator.setSpeedModifier(1.0D);
navigator.setSpeedModifier(1.5D);
return navigator;
}

Expand Down Expand Up @@ -288,7 +291,7 @@ protected void tickDeath() {
public void investigateBlocks() {
if (level.isClientSide() || !level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !WAConfiguration.CONFIG.blockBreaking.get())
return;
for (Iterator<BlockPos> iterator = BlockPos.withinManhattanStream(blockPosition(), 25, 3, 25).iterator(); iterator.hasNext(); ) {
for (Iterator<BlockPos> iterator = BlockPos.withinManhattanStream(blockPosition(), 15, 3, 15).iterator(); iterator.hasNext(); ) {
BlockPos pos = iterator.next();
BlockState blockState = level.getBlockState(pos);
BlockReactions.BlockReaction blockBehaviour = BlockReactions.BLOCK_BEHAVIOUR.get(blockState.getBlock());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.util.Collection;
import java.util.Map;
import java.util.stream.Collectors;

public class AngelVariant {

Expand Down Expand Up @@ -64,36 +65,35 @@ public ItemStack getDrops() {
}


// TODO Nicer way
public static AngelVariant getVariantForPos(WeepingAngel weepingAngel) {
RandomSource randomSource = weepingAngel.level.random;
int yPosition = weepingAngel.blockPosition().getY();

boolean isOrePosition = weepingAngel.blockPosition().getY() < 50 && !weepingAngel.level.canSeeSky(weepingAngel.blockPosition());

Holder<Biome> currentBiome = weepingAngel.level.getBiome(weepingAngel.blockPosition());
boolean isNether = currentBiome.is(BiomeTags.IS_NETHER);
boolean isJungle = currentBiome.is(BiomeTags.IS_JUNGLE);

if (isJungle) {
// Check for Jungle biome
if (weepingAngel.level.getBiome(weepingAngel.blockPosition()).is(BiomeTags.IS_JUNGLE)) {
return MOSSY;
}

// Nether Related
if (isNether) {
// Check for Nether biome
if (weepingAngel.level.getBiome(weepingAngel.blockPosition()).is(BiomeTags.IS_NETHER)) {
return randomSource.nextBoolean() ? QUARTZ : BASALT;
}

// Ores
if (isOrePosition && randomSource.nextInt(100) < 10) {
// Check for ore position
if (yPosition < 50 && !weepingAngel.level.canSeeSky(weepingAngel.blockPosition()) && randomSource.nextInt(100) < 10) {
return getRandomVariant(ORE_VARIANTS, randomSource);
}

// Random value after conditions
Collection<AngelVariant> variants = VARIANTS.values();
variants.removeIf(angelTextureVariant -> angelTextureVariant == QUARTZ || angelTextureVariant == MOSSY || angelTextureVariant == BASALT || ORE_VARIANTS.containsKey(angelTextureVariant.regName));
return variants.stream().skip((int) (variants.size() * Math.random())).findFirst().get();
// Filter out specific variants
Collection<AngelVariant> variants = VARIANTS.values().stream()
.filter(v -> v != QUARTZ && v != MOSSY && v != BASALT && !ORE_VARIANTS.containsKey(v.regName))
.toList();

// Return a random variant from the filtered list
return variants.stream().skip((int) (variants.size() * Math.random())).findFirst().orElse(null);
}


public static AngelVariant getRandomVariant(Map<ResourceLocation, AngelVariant> variantMap, RandomSource randomSource) {
int index = randomSource.nextInt(variantMap.size());
return variantMap.values().toArray(new AngelVariant[0])[index];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ public ThrowableGeneratorItem(Item.Properties properties) {
super(properties);
}

@Override
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand usedHand) {
if (usedHand == InteractionHand.OFF_HAND) return InteractionResultHolder.fail(player.getItemInHand(usedHand));
ItemStack itemStack = player.getItemInHand(usedHand);
ItemStack offHand = player.getItemInHand(InteractionHand.OFF_HAND);

if (!level.isClientSide) {
ThrowableGenerator throwableGenerator = new ThrowableGenerator(player, level);
throwableGenerator.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F);
throwableGenerator.setActivated(offHand.is(WAItems.KONTRON_INGOT.get()));
if(offHand.is(WAItems.KONTRON_INGOT.get()) && !player.isCreative()){
offHand.shrink(1);
}
throwableGenerator.setActivated(true);
level.addFreshEntity(throwableGenerator);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class WAItems {
public static final RegistrySupplier<Item> TIMEY_WIMEY_DETECTOR = ITEMS.register("timey_wimey_detector", () -> new DetectorItem(new Item.Properties().stacksTo(1).tab(MAIN_TAB)));
public static final RegistrySupplier<Item> DISC_TIME_PREVAILS = ITEMS.register("music_disc_time_prevails", () -> new DiscItem(88, WASounds.DISC_TIME_PREVAILS.get(), (new Item.Properties()).stacksTo(1).tab(MAIN_TAB).rarity(Rarity.RARE), 320));
public static final RegistrySupplier<Item> DISC_SALLY = ITEMS.register("music_disc_sally", () -> new DiscItem(89, WASounds.DISC_SALLY.get(), (new Item.Properties()).stacksTo(1).tab(MAIN_TAB).rarity(Rarity.RARE), 1300));
public static final RegistrySupplier<Item> KONTRON_INGOT = ITEMS.register("kontron_ingot", () -> new Item(new Item.Properties().tab(MAIN_TAB)));
public static final RegistrySupplier<Item> CHRONODYNE_GENERATOR = ITEMS.register("chronodyne_generator", () -> new ThrowableGeneratorItem(new Item.Properties().stacksTo(6).tab(MAIN_TAB)));
public static final RegistrySupplier<Item> ANGEL_SPAWNER = ITEMS.register("angel_spawner", () -> new SpawnerItem(WAEntities.WEEPING_ANGEL::get, new Item.Properties().tab(MAIN_TAB)));

Expand Down
Loading

0 comments on commit 0cc5b72

Please sign in to comment.