Merge branch 'mc1.20.1/feature-dev' into jay/mc1.20.1/attached-registry-refactors

This commit is contained in:
TropheusJ 2025-02-19 10:57:53 -05:00
commit 7ba5566c79
8 changed files with 591 additions and 527 deletions

View file

@ -129,6 +129,7 @@ _Now using Flywheel 1.0_
- Fixed lighting on signal block indicators
- Fixed vaults and tanks rotated in place not updating their multiblock correctly
- Hose pulley now deletes lilypads and other surface foliage
- Fixed crushing wheels not applying looting to killed entities
#### API Changes

View file

@ -16,7 +16,6 @@ import com.simibubi.create.foundation.model.BakedModelWrapperWithData;
import net.createmod.catnip.data.Iterate;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.resources.model.BakedModel;
@ -25,6 +24,7 @@ import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.ChunkRenderTypeSet;
import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.client.model.data.ModelData.Builder;
@ -65,14 +65,26 @@ public class PipeAttachmentModel extends BakedModelWrapperWithData {
return builder.with(PIPE_PROPERTY, data);
}
// TODO: Update once MinecraftForge#9163 is merged
@Override
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
if (set.isEmpty()) {
return ItemBlockRenderTypes.getRenderLayers(state);
List<ChunkRenderTypeSet> set = new ArrayList<>();
set.add(super.getRenderTypes(state, rand, data));
set.add(AllPartialModels.FLUID_PIPE_CASING.get().getRenderTypes(state, rand, data));
if (data.has(PIPE_PROPERTY)) {
PipeModelData pipeData = data.get(PIPE_PROPERTY);
for (Direction d : Iterate.directions) {
AttachmentTypes type = pipeData.getAttachment(d);
for (ComponentPartials partial : type.partials) {
ChunkRenderTypeSet attachmentRenderTypeSet = AllPartialModels.PIPE_ATTACHMENTS.get(partial).get(d)
.get().getRenderTypes(state, rand, data);
set.add(attachmentRenderTypeSet);
}
return set;
}
}
return ChunkRenderTypeSet.union(set);
}
@Override

View file

@ -195,7 +195,8 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
if (stats == null)
continue;
Travelling: for (Iterator<ChainConveyorPackage> iterator = entry.getValue()
Travelling:
for (Iterator<ChainConveyorPackage> iterator = entry.getValue()
.iterator(); iterator.hasNext(); ) {
ChainConveyorPackage box = iterator.next();
box.justFlipped = false;
@ -251,7 +252,8 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
}
}
Looping: for (Iterator<ChainConveyorPackage> iterator = loopingPackages.iterator(); iterator.hasNext();) {
Looping:
for (Iterator<ChainConveyorPackage> iterator = loopingPackages.iterator(); iterator.hasNext(); ) {
ChainConveyorPackage box = iterator.next();
box.justFlipped = false;
@ -774,7 +776,7 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
@Override
public ItemRequirement getRequiredItems(BlockState state) {
// Uncomment when Schematicannon is able to print these with chains
// TODO: Uncomment when Schematicannon is able to print these with chains
// int totalCost = 0;
// for (BlockPos pos : connections)
// totalCost += getChainCost(pos);

View file

@ -16,6 +16,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LootingLevelEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -57,12 +58,14 @@ public class CrushingWheelBlockEntity extends KineticBlockEntity {
fixControllers();
}
// This increases the drops when dropCustomDeathLoot is called, and LootingEnchantFunctionMixin increases the drops
// defined in the entity loot table
@SubscribeEvent
public static void crushingIsFortunate(LootingLevelEvent event) {
DamageSource damageSource = event.getDamageSource();
if (damageSource == null || !damageSource.is(AllDamageTypes.CRUSH))
return;
event.setLootingLevel(2); //This does not currently increase mob drops. It seems like this only works for damage done by an entity.
event.setLootingLevel(2);
}
@SubscribeEvent

View file

@ -280,7 +280,6 @@ public class AllAdvancements implements DataProvider {
.after(CARDBOARD_ARMOR)
.special(SECRET)),
// TODO: award using AllAdvancements.CARDBOARD_ARMOR_TRIM.awardTo() on server
CARDBOARD_ARMOR_TRIM = create("cardboard_armor_trim",
b -> b.icon(createArmorTrimmedCardboardChestplate())
.title("Arts and Crafts")
@ -715,6 +714,7 @@ public class AllAdvancements implements DataProvider {
advancement.provideLang(consumer);
}
public static void register() {}
public static void register() {
}
}

View file

@ -0,0 +1,44 @@
package com.simibubi.create.foundation.mixin;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.simibubi.create.AllDamageTypes;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.functions.LootingEnchantFunction;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
@Mixin(LootingEnchantFunction.class)
public abstract class LootingEnchantFunctionMixin {
@Shadow
@Final
NumberProvider value;
@Shadow
@Final
int limit;
@Shadow
abstract boolean hasLimit();
@Inject(method = "run", at = @At("TAIL"))
private void create$crushingWheelsHaveLooting(ItemStack stack, LootContext context, CallbackInfoReturnable<ItemStack> cir) {
DamageSource damageSource = context.getParamOrNull(LootContextParams.DAMAGE_SOURCE);
if (damageSource != null && damageSource.is(AllDamageTypes.CRUSH)) {
int lootingLevel = 2;
float f = (float) lootingLevel * this.value.getFloat(context);
stack.grow(Math.round(f));
if (this.hasLimit() && stack.getCount() > this.limit)
stack.setCount(this.limit);
}
}
}

View file

@ -4,6 +4,7 @@
"1": "create:block/roller_metal",
"particle": "create:block/roller_casing"
},
"render_type": "minecraft:cutout",
"elements": [
{
"name": "Axle left",

View file

@ -14,6 +14,7 @@
"CustomItemUseEffectsMixin",
"EntityMixin",
"LavaSwimmingMixin",
"LootingEnchantFunctionMixin",
"MapItemSavedDataMixin",
"ProjectileUtilMixin",
"ShulkerBoxBlockMixin",