mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Merge branch 'mc1.20.1/feature-dev' into jay/mc1.20.1/attached-registry-refactors
This commit is contained in:
commit
7ba5566c79
8 changed files with 591 additions and 527 deletions
|
@ -128,7 +128,8 @@ _Now using Flywheel 1.0_
|
||||||
- Fixed stations voiding schedules when disassembling the train
|
- Fixed stations voiding schedules when disassembling the train
|
||||||
- Fixed lighting on signal block indicators
|
- Fixed lighting on signal block indicators
|
||||||
- Fixed vaults and tanks rotated in place not updating their multiblock correctly
|
- Fixed vaults and tanks rotated in place not updating their multiblock correctly
|
||||||
- Hose pulley now deletes lilypads and other surface foliage
|
- Hose pulley now deletes lilypads and other surface foliage
|
||||||
|
- Fixed crushing wheels not applying looting to killed entities
|
||||||
|
|
||||||
#### API Changes
|
#### API Changes
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import com.simibubi.create.foundation.model.BakedModelWrapperWithData;
|
||||||
|
|
||||||
import net.createmod.catnip.data.Iterate;
|
import net.createmod.catnip.data.Iterate;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.resources.model.BakedModel;
|
import net.minecraft.client.resources.model.BakedModel;
|
||||||
|
@ -25,6 +24,7 @@ import net.minecraft.core.Direction;
|
||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
import net.minecraft.world.level.BlockAndTintGetter;
|
import net.minecraft.world.level.BlockAndTintGetter;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||||
import net.minecraftforge.client.model.data.ModelData;
|
import net.minecraftforge.client.model.data.ModelData;
|
||||||
import net.minecraftforge.client.model.data.ModelData.Builder;
|
import net.minecraftforge.client.model.data.ModelData.Builder;
|
||||||
|
@ -50,7 +50,7 @@ public class PipeAttachmentModel extends BakedModelWrapperWithData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ModelData.Builder gatherModelData(Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
protected ModelData.Builder gatherModelData(Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||||
ModelData blockEntityData) {
|
ModelData blockEntityData) {
|
||||||
PipeModelData data = new PipeModelData();
|
PipeModelData data = new PipeModelData();
|
||||||
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||||
BracketedBlockEntityBehaviour bracket = BlockEntityBehaviour.get(world, pos, BracketedBlockEntityBehaviour.TYPE);
|
BracketedBlockEntityBehaviour bracket = BlockEntityBehaviour.get(world, pos, BracketedBlockEntityBehaviour.TYPE);
|
||||||
|
@ -65,14 +65,26 @@ public class PipeAttachmentModel extends BakedModelWrapperWithData {
|
||||||
return builder.with(PIPE_PROPERTY, data);
|
return builder.with(PIPE_PROPERTY, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Update once MinecraftForge#9163 is merged
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||||
ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
List<ChunkRenderTypeSet> set = new ArrayList<>();
|
||||||
if (set.isEmpty()) {
|
|
||||||
return ItemBlockRenderTypes.getRenderLayers(state);
|
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
|
@Override
|
||||||
|
@ -102,7 +114,7 @@ public class PipeAttachmentModel extends BakedModelWrapperWithData {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
||||||
PipeModelData pipeData, RenderType renderType) {
|
PipeModelData pipeData, RenderType renderType) {
|
||||||
BakedModel bracket = pipeData.getBracket();
|
BakedModel bracket = pipeData.getBracket();
|
||||||
if (bracket != null)
|
if (bracket != null)
|
||||||
quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
|
quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
|
||||||
return false;
|
return false;
|
||||||
if (connection != null
|
if (connection != null
|
||||||
&& (!(level.getBlockEntity(worldPosition.offset(connection)) instanceof ChainConveyorBlockEntity otherClbe)
|
&& (!(level.getBlockEntity(worldPosition.offset(connection)) instanceof ChainConveyorBlockEntity otherClbe)
|
||||||
|| !otherClbe.canAcceptMorePackages()))
|
|| !otherClbe.canAcceptMorePackages()))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
|
||||||
if (!(level.getBlockEntity(worldPosition.offset(offset)) instanceof ChainConveyorBlockEntity otherLift))
|
if (!(level.getBlockEntity(worldPosition.offset(offset)) instanceof ChainConveyorBlockEntity otherLift))
|
||||||
continue;
|
continue;
|
||||||
for (Iterator<ChainConveyorPackage> iterator = entry.getValue()
|
for (Iterator<ChainConveyorPackage> iterator = entry.getValue()
|
||||||
.iterator(); iterator.hasNext();) {
|
.iterator(); iterator.hasNext(); ) {
|
||||||
ChainConveyorPackage box = iterator.next();
|
ChainConveyorPackage box = iterator.next();
|
||||||
if (box.justFlipped)
|
if (box.justFlipped)
|
||||||
continue;
|
continue;
|
||||||
|
@ -195,8 +195,9 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
|
||||||
if (stats == null)
|
if (stats == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Travelling: for (Iterator<ChainConveyorPackage> iterator = entry.getValue()
|
Travelling:
|
||||||
.iterator(); iterator.hasNext();) {
|
for (Iterator<ChainConveyorPackage> iterator = entry.getValue()
|
||||||
|
.iterator(); iterator.hasNext(); ) {
|
||||||
ChainConveyorPackage box = iterator.next();
|
ChainConveyorPackage box = iterator.next();
|
||||||
box.justFlipped = false;
|
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();
|
ChainConveyorPackage box = iterator.next();
|
||||||
box.justFlipped = false;
|
box.justFlipped = false;
|
||||||
|
|
||||||
|
@ -313,7 +315,7 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
|
||||||
|
|
||||||
public void removeInvalidConnections() {
|
public void removeInvalidConnections() {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
for (Iterator<BlockPos> iterator = connections.iterator(); iterator.hasNext();) {
|
for (Iterator<BlockPos> iterator = connections.iterator(); iterator.hasNext(); ) {
|
||||||
BlockPos next = iterator.next();
|
BlockPos next = iterator.next();
|
||||||
BlockPos target = worldPosition.offset(next);
|
BlockPos target = worldPosition.offset(next);
|
||||||
if (!level.isLoaded(target))
|
if (!level.isLoaded(target))
|
||||||
|
@ -584,7 +586,7 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
|
||||||
|
|
||||||
private void spawnDestroyParticles(BlockPos blockPos) {
|
private void spawnDestroyParticles(BlockPos blockPos) {
|
||||||
forPointsAlongChains(blockPos, (int) Math.round(Vec3.atLowerCornerOf(blockPos)
|
forPointsAlongChains(blockPos, (int) Math.round(Vec3.atLowerCornerOf(blockPos)
|
||||||
.length() * 8),
|
.length() * 8),
|
||||||
vec -> level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, Blocks.CHAIN.defaultBlockState()),
|
vec -> level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, Blocks.CHAIN.defaultBlockState()),
|
||||||
vec.x, vec.y, vec.z, 0, 0, 0));
|
vec.x, vec.y, vec.z, 0, 0, 0));
|
||||||
}
|
}
|
||||||
|
@ -652,7 +654,7 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float propagateRotationTo(KineticBlockEntity target, BlockState stateFrom, BlockState stateTo, BlockPos diff,
|
public float propagateRotationTo(KineticBlockEntity target, BlockState stateFrom, BlockState stateTo, BlockPos diff,
|
||||||
boolean connectedViaAxes, boolean connectedViaCogs) {
|
boolean connectedViaAxes, boolean connectedViaCogs) {
|
||||||
if (connections.contains(target.getBlockPos()
|
if (connections.contains(target.getBlockPos()
|
||||||
.subtract(worldPosition))) {
|
.subtract(worldPosition))) {
|
||||||
if (!(target instanceof ChainConveyorBlockEntity))
|
if (!(target instanceof ChainConveyorBlockEntity))
|
||||||
|
@ -774,7 +776,7 @@ public class ChainConveyorBlockEntity extends KineticBlockEntity implements Tran
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemRequirement getRequiredItems(BlockState state) {
|
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;
|
// int totalCost = 0;
|
||||||
// for (BlockPos pos : connections)
|
// for (BlockPos pos : connections)
|
||||||
// totalCost += getChainCost(pos);
|
// totalCost += getChainCost(pos);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||||
import net.minecraftforge.event.entity.living.LootingLevelEvent;
|
import net.minecraftforge.event.entity.living.LootingLevelEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
@ -43,7 +44,7 @@ public class CrushingWheelBlockEntity extends KineticBlockEntity {
|
||||||
public void fixControllers() {
|
public void fixControllers() {
|
||||||
for (Direction d : Iterate.directions)
|
for (Direction d : Iterate.directions)
|
||||||
((CrushingWheelBlock) getBlockState().getBlock()).updateControllers(getBlockState(), getLevel(), getBlockPos(),
|
((CrushingWheelBlock) getBlockState().getBlock()).updateControllers(getBlockState(), getLevel(), getBlockPos(),
|
||||||
d);
|
d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,12 +58,14 @@ public class CrushingWheelBlockEntity extends KineticBlockEntity {
|
||||||
fixControllers();
|
fixControllers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This increases the drops when dropCustomDeathLoot is called, and LootingEnchantFunctionMixin increases the drops
|
||||||
|
// defined in the entity loot table
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void crushingIsFortunate(LootingLevelEvent event) {
|
public static void crushingIsFortunate(LootingLevelEvent event) {
|
||||||
DamageSource damageSource = event.getDamageSource();
|
DamageSource damageSource = event.getDamageSource();
|
||||||
if (damageSource == null || !damageSource.is(AllDamageTypes.CRUSH))
|
if (damageSource == null || !damageSource.is(AllDamageTypes.CRUSH))
|
||||||
return;
|
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
|
@SubscribeEvent
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
"1": "create:block/roller_metal",
|
"1": "create:block/roller_metal",
|
||||||
"particle": "create:block/roller_casing"
|
"particle": "create:block/roller_casing"
|
||||||
},
|
},
|
||||||
|
"render_type": "minecraft:cutout",
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"name": "Axle left",
|
"name": "Axle left",
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
"CustomItemUseEffectsMixin",
|
"CustomItemUseEffectsMixin",
|
||||||
"EntityMixin",
|
"EntityMixin",
|
||||||
"LavaSwimmingMixin",
|
"LavaSwimmingMixin",
|
||||||
|
"LootingEnchantFunctionMixin",
|
||||||
"MapItemSavedDataMixin",
|
"MapItemSavedDataMixin",
|
||||||
"ProjectileUtilMixin",
|
"ProjectileUtilMixin",
|
||||||
"ShulkerBoxBlockMixin",
|
"ShulkerBoxBlockMixin",
|
||||||
|
|
Loading…
Add table
Reference in a new issue