Merge remote-tracking branch 'architectury/1.16' into 1.17

Signed-off-by: shedaniel <daniel@shedaniel.me>

# Conflicts:
#	common/src/main/java/me/shedaniel/architectury/event/events/EntityEvent.java
#	common/src/main/java/me/shedaniel/architectury/registry/entity/EntityRenderers.java
#	common/src/main/java/me/shedaniel/architectury/utils/Fraction.java
#	fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/EntityHooksImpl.java
#	fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCollisionContext.java
#	fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinEntityCollisionContext.java
#	fabric/src/main/java/me/shedaniel/architectury/registry/entity/fabric/EntityRenderersImpl.java
#	fabric/src/main/resources/architectury.mixins.json
#	gradle.properties
This commit is contained in:
shedaniel
2021-05-03 00:53:00 +08:00
238 changed files with 1574 additions and 238 deletions

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,11 @@ package me.shedaniel.architectury.event.forge;
import me.shedaniel.architectury.event.Actor;
import me.shedaniel.architectury.event.Event;
import me.shedaniel.architectury.event.EventActor;
import me.shedaniel.architectury.event.EventResult;
import net.minecraft.world.InteractionResult;
import net.minecraftforge.common.MinecraftForge;
import org.jetbrains.annotations.ApiStatus;
import java.util.function.Consumer;
@@ -63,4 +66,36 @@ public class EventFactoryImpl {
});
return event;
}
}
@ApiStatus.Internal
public static <T> Event<EventActor<T>> attachToForgeEventActor(Event<EventActor<T>> event) {
event.register(eventObj -> {
if (!(eventObj instanceof net.minecraftforge.eventbus.api.Event)) {
throw new ClassCastException(eventObj.getClass() + " is not an instance of forge Event!");
}
if (!((net.minecraftforge.eventbus.api.Event) eventObj).isCancelable()) {
throw new ClassCastException(eventObj.getClass() + " is not cancellable Event!");
}
MinecraftForge.EVENT_BUS.post((net.minecraftforge.eventbus.api.Event) eventObj);
return EventResult.pass();
});
return event;
}
@ApiStatus.Internal
public static <T> Event<EventActor<T>> attachToForgeEventActorCancellable(Event<EventActor<T>> event) {
event.register(eventObj -> {
if (!(eventObj instanceof net.minecraftforge.eventbus.api.Event)) {
throw new ClassCastException(eventObj.getClass() + " is not an instance of forge Event!");
}
if (!((net.minecraftforge.eventbus.api.Event) eventObj).isCancelable()) {
throw new ClassCastException(eventObj.getClass() + " is not cancellable Event!");
}
if (MinecraftForge.EVENT_BUS.post((net.minecraftforge.eventbus.api.Event) eventObj)) {
return EventResult.interrupt(false);
}
return EventResult.pass();
});
return event;
}
}

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,6 +19,9 @@
package me.shedaniel.architectury.event.forge;
import me.shedaniel.architectury.event.CompoundEventResult;
import me.shedaniel.architectury.event.EventResult;
import me.shedaniel.architectury.event.events.PlayerEvent;
import me.shedaniel.architectury.event.events.*;
import me.shedaniel.architectury.utils.IntValue;
import net.minecraft.network.chat.Component;
@@ -35,17 +38,17 @@ import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.TickEvent.PlayerTickEvent;
import net.minecraftforge.event.TickEvent.ServerTickEvent;
import net.minecraftforge.event.TickEvent.WorldTickEvent;
import net.minecraftforge.event.entity.EntityEvent.EnteringChunk;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.player.AdvancementEvent;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.entity.player.PlayerEvent.*;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
import net.minecraftforge.event.world.BlockEvent.FarmlandTrampleEvent;
import net.minecraftforge.event.world.ExplosionEvent.Detonate;
import net.minecraftforge.event.world.ExplosionEvent.Start;
import net.minecraftforge.event.world.WorldEvent;
@@ -214,6 +217,43 @@ public class EventHandlerImplCommon {
}
}
@SubscribeEvent(priority = EventPriority.HIGH)
public static void event(FarmlandTrampleEvent event) {
if (InteractionEvent.FARMLAND_TRAMPLE.invoker().trample((Level) event.getWorld(), event.getPos(), event.getState(), event.getFallDistance(), event.getEntity()).value() != null) {
event.setCanceled(true);
}
}
@SubscribeEvent(priority = EventPriority.HIGH)
public static void event(FillBucketEvent event) {
ItemStack oldItem = event.getEmptyBucket();
CompoundEventResult<ItemStack> result = PlayerEvent.FILL_BUCKET.invoker().fill(event.getPlayer(), event.getWorld(), oldItem, event.getTarget());
if (result.interruptsFurtherEvaluation()) {
event.setCanceled(true);
event.setFilledBucket(result.object());
if (result.value() != null) {
event.setResult(result.value() ? Event.Result.ALLOW : Event.Result.DENY);
}
}
}
@SubscribeEvent(priority = EventPriority.HIGH)
public static void event(EnteringChunk event) {
EntityEvent.ENTER_CHUNK.invoker().enterChunk(event.getEntity(), event.getNewChunkX(), event.getNewChunkZ(), event.getOldChunkX(), event.getOldChunkZ());
}
@SubscribeEvent(priority = EventPriority.HIGH)
public static void event(LivingSpawnEvent.CheckSpawn event) {
EventResult result = EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(event.getEntityLiving(), event.getWorld(), event.getX(), event.getY(), event.getZ(), event.getSpawnReason(), event.getSpawner());
if (result.interruptsFurtherEvaluation()) {
if (result.value() != null) {
event.setResult(result.value() == Boolean.TRUE ? Event.Result.ALLOW : Event.Result.DENY);
}
event.setCanceled(true);
}
}
@SubscribeEvent(priority = EventPriority.HIGH)
public static void event(ItemCraftedEvent event) {
PlayerEvent.CRAFT_ITEM.invoker().craft(event.getPlayer(), event.getCrafting(), event.getInventory());

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -0,0 +1,43 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 architectury
*
* This program 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 program 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 program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package me.shedaniel.architectury.mixin.forge;
import me.shedaniel.architectury.extensions.ItemExtension;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraftforge.common.extensions.IForgeItem;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(ItemExtension.class)
public interface MixinItemExtension extends IForgeItem {
@Override
default void onArmorTick(ItemStack stack, Level world, Player player) {
((ItemExtension) this).tickArmor(stack, player);
}
@Nullable
@Override
default EquipmentSlot getEquipmentSlot(ItemStack stack) {
return ((ItemExtension) this).getCustomEquipmentSlot(stack);
}
}

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,3 +1,22 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 architectury
*
* This program 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 program 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 program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package me.shedaniel.architectury.registry.entity.forge;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,6 +1,6 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 shedaniel
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@@ -1,7 +1,7 @@
modLoader = "javafml"
loaderVersion = "[33,)"
issueTrackerURL = "https://github.com/shedaniel/architectury/issues"
license = "LGPL-3"
license = "GNU LGPLv3"
[[mods]]
modId = "architectury"
@@ -11,4 +11,12 @@ authors = "shedaniel"
description = '''
A intermediary api aimed to ease developing multiplatform mods.
'''
license = "LGPL-3"
logoFile="icon.png"
license = "LGPL-3"
[[dependencies.architectury]]
modId = "minecraft"
mandatory = true
versionRange = "[1.16.2,)"
ordering = "NONE"
side = "BOTH"

View File

@@ -7,8 +7,9 @@
"client": [
],
"mixins": [
"BiomeGenerationSettingsBuilderAccessor", "MixinRegistryEntry", "MixinBlockEntity", "MixinBlockEntityExtension",
"MobSpawnSettingsBuilderAccessor", "GameRulesAccessor", "GameRulesAccessor$BooleanValue", "GameRulesAccessor$BooleanValueSimple", "GameRulesAccessor$IntegerValue", "GameRulesAccessor$IntegerValueSimple"
"BiomeGenerationSettingsBuilderAccessor", "GameRulesAccessor", "GameRulesAccessor$BooleanValue", "GameRulesAccessor$BooleanValueSimple",
"GameRulesAccessor$IntegerValue", "GameRulesAccessor$IntegerValueSimple", "MixinBlockEntity", "MixinBlockEntityExtension", "MixinItemExtension",
"MixinRegistryEntry", "MobSpawnSettingsBuilderAccessor"
],
"injectors": {
"defaultRequire": 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB