Skip to content

Commit

Permalink
Merge branch 'forge-dev' into forge-release/1.21
Browse files Browse the repository at this point in the history
# Conflicts:
#	StaffMod/src/main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt
#	gradle/libs.versions.toml
  • Loading branch information
opekope2 committed Dec 1, 2024
2 parents 4f1dbfc + 494a2de commit 2ade8d6
Show file tree
Hide file tree
Showing 125 changed files with 5,162 additions and 1,772 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* AvM Staff Mod
* Copyright (c) 2024 opekope2
*
* This mod is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This mod is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this mod. If not, see <https://www.gnu.org/licenses/>.
*/

package opekope2.avm_staff.mixin;

import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.util.Identifier;
import opekope2.avm_staff.api.block.IClearableBeforeInsertedIntoStaff;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(AbstractFurnaceBlockEntity.class)
public abstract class AbstractFurnaceBlockEntityMixin implements IClearableBeforeInsertedIntoStaff {
@Shadow
@Final
private Object2IntOpenHashMap<Identifier> recipesUsed;

@Override
public void staffMod_clearBeforeRemovedFromWorld() {
recipesUsed.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
import opekope2.avm_staff.api.StaffMod;
import opekope2.avm_staff.api.component.StaffRendererOverrideComponent;
import opekope2.avm_staff.util.ItemStackUtil;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -71,9 +69,6 @@ private void positionRightArm(LivingEntity entity, CallbackInfo ci) {
@Unique
private boolean staffMod$pointForward(BipedEntityModel.ArmPose armPose, LivingEntity entity) {
if (armPose != BipedEntityModel.ArmPose.ITEM) return false;
if (!ItemStackUtil.isStaff(entity.getActiveItem())) return false;

StaffRendererOverrideComponent rendererOverride = entity.getActiveItem().get(StaffMod.getStaffRendererOverrideComponentType().get());
return rendererOverride == null || rendererOverride.isActive().orElse(true);
return ItemStackUtil.isStaff(entity.getActiveItem());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* AvM Staff Mod
* Copyright (c) 2024 opekope2
*
* This mod is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This mod is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this mod. If not, see <https://www.gnu.org/licenses/>.
*/

package opekope2.avm_staff.mixin;

import net.minecraft.block.entity.BellBlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BellBlockEntity.class)
public interface IBellBlockEntityAccessor {
@Invoker
static void callApplyGlowToEntity(LivingEntity entity) {
throw new AssertionError();
}

@Invoker
static boolean callIsRaiderEntity(BlockPos pos, LivingEntity entity) {
throw new AssertionError();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* AvM Staff Mod
* Copyright (c) 2024 opekope2
*
* This mod is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This mod is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this mod. If not, see <https://www.gnu.org/licenses/>.
*/

package opekope2.avm_staff.mixin;

import net.minecraft.block.entity.SculkShriekerBlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.server.network.ServerPlayerEntity;
import opekope2.avm_staff.api.entity.CakeEntity;
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(SculkShriekerBlockEntity.class)
public abstract class SculkShriekerBlockEntityMixin {
@Inject(method = "findResponsiblePlayerFromEntity", at = @At("TAIL"), cancellable = true)
private static void findResponsiblePlayerFromCake(Entity entity, CallbackInfoReturnable<ServerPlayerEntity> cir) {
if (entity instanceof CakeEntity cake) {
Entity owner = cake.getOwner();
if (owner instanceof ServerPlayerEntity player) {
cir.setReturnValue(player);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.spongepowered.asm.mixin.Shadow;

@Mixin(TurtleEggBlock.class)
public class TurtleEggBlockMixin implements IBlockAfterDestroyHandler {
public abstract class TurtleEggBlockMixin implements IBlockAfterDestroyHandler {
@Shadow
@Final
public static IntProperty EGGS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package opekope2.avm_staff.api
import net.minecraft.block.Block
import net.minecraft.item.Item
import net.minecraft.particle.SimpleParticleType
import net.minecraftforge.registries.RegistryObject
import opekope2.avm_staff.api.IStaffModPlatform.Instance
import opekope2.avm_staff.api.item.CrownItem
import opekope2.avm_staff.api.item.StaffItem
Expand All @@ -37,7 +38,7 @@ interface IStaffModPlatform {
*
* @param settings The item settings to pass to the constructor
*/
fun staffItem(settings: Item.Settings): StaffItem
fun staffItem(settings: Item.Settings, repairIngredient: RegistryObject<Item>?): StaffItem

/**
* Creates an item, which is rendered like a staff.
Expand Down
Loading

0 comments on commit 2ade8d6

Please sign in to comment.