Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/mc1.18/fabric/dev' into mc1.18/f…
Browse files Browse the repository at this point in the history
…abric/dev

# Conflicts:
#	FABRIC_CHANGELOG.txt
  • Loading branch information
TropheusJ committed Apr 5, 2024
2 parents f79ca3d + 8309a67 commit f8dcba4
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 17 deletions.
3 changes: 3 additions & 0 deletions FABRIC_CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ Change logging starts below:
- add cycling to the block displayed in manual item application in EMI
- make hidden items not show up in REI & EMI
- fix backtanks not updating neighboring blocks (#1396)
- fix basin tooltips not updating when removing fluid (#1411)
- fix outputs of draining recipes not being indexed (#1409)
- fix incorrect chances being shown on fan recipes (#1393)
- fix stress tooltips not being shown until entering singleplayer (#1265)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ reach_entity_attributes_version = 2.1.1
registrate_version = MC1.18.2-1.1.11
forge_tags_version = 2.1
milk_lib_version = 0.3.2
port_lib_version = 1.2.1294-beta
port_lib_version = 1.2.1304-beta

night_config_version = 3.6.3
jsr305_version = 3.0.2
Expand Down
9 changes: 9 additions & 0 deletions gradle/compat/mods/bits_and_chisels.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repositories {
maven { url = "https://api.modrinth.com/maven" }
}

String bncVersion = "2.6.13"

dependencies {
modLocalRuntime("maven.modrinth:bits-and-chisels:$bncVersion")
}
2 changes: 2 additions & 0 deletions src/main/java/com/simibubi/create/compat/rei/CreateREI.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.simibubi.create.compat.rei.category.SpoutCategory;
import com.simibubi.create.compat.rei.display.BasinDisplay;
import com.simibubi.create.compat.rei.display.CreateDisplay;
import com.simibubi.create.compat.rei.display.DrainDisplay;
import com.simibubi.create.content.equipment.sandPaper.SandPaperPolishingRecipe;
import com.simibubi.create.content.fluids.VirtualFluid;
import com.simibubi.create.content.fluids.potion.PotionMixingRecipes;
Expand Down Expand Up @@ -281,6 +282,7 @@ private void loadCategories() {
.catalyst(AllBlocks.ITEM_DRAIN::get)
.doubleItemIcon(AllBlocks.ITEM_DRAIN.get(), Items.WATER_BUCKET)
.emptyBackground(177, 56)
.displayFactory(DrainDisplay::new)
.build("draining", ItemDrainCategory::new),

autoShaped = builder(CraftingRecipe.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@

import me.shedaniel.math.Point;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Recipe;

Expand Down Expand Up @@ -106,12 +111,20 @@ public void addWidgets(CreateDisplay<T> display, List<Widget> ingredients, Point
int xOffset = (outputIndex % 3) * 19 + xOffsetOutput;
int yOffset = (outputIndex / 3) * -19 + (excessive ? 8 : 0);

ProcessingOutput output = results.get(outputIndex);
EntryStack<ItemStack> stack = EntryStack.of(VanillaEntryTypes.ITEM, output.getStack());
float chance = output.getChance();

if (chance != 1) {
Component component = Lang.translateDirect("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100))
.withStyle(ChatFormatting.GOLD);
stack.tooltip(component);
}

ingredients.add(basicSlot(origin.x + 141 + xOffset, origin.y + 48 + yOffset)
.markOutput()
.entries(EntryIngredients.of(results.get(outputIndex).getStack())));
.entries(List.of(stack)));
}

addStochasticTooltip(ingredients, results);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.simibubi.create.compat.rei.display;

import java.util.List;

import com.simibubi.create.Create;
import com.simibubi.create.compat.rei.category.CreateRecipeCategory;
import com.simibubi.create.content.fluids.transfer.EmptyingRecipe;

import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes;
import me.shedaniel.rei.api.common.util.EntryIngredients;

public class DrainDisplay extends CreateDisplay<EmptyingRecipe> {
public static final CategoryIdentifier<CreateDisplay<EmptyingRecipe>> ID = CategoryIdentifier.of(Create.asResource("draining"));

public DrainDisplay(EmptyingRecipe recipe) {
super(
recipe,
ID,
EntryIngredients.ofIngredients(recipe.getIngredients()),
List.of(
EntryIngredients.ofItemStacks(recipe.getRollableResultsAsItemStacks()),
EntryIngredients.of(VanillaEntryTypes.FLUID, CreateRecipeCategory.convertToREIFluids(recipe.getFluidResults()))
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,18 @@ public void emitBlockQuads(BlockAndTintGetter blockView, BlockState state, Block
}
}

// fabric: If it is the default state do not push transformations, will cause issues with GhostBlockRenderer
boolean shouldTransform = material != AllBlocks.COPYCAT_BASE.getDefaultState();

// fabric: need to change the default render material
context.pushTransform(MaterialFixer.create(material));
if (shouldTransform)
context.pushTransform(MaterialFixer.create(material));

emitBlockQuadsInner(blockView, state, pos, randomSupplier, context, material, cullFaceRemovalData, occlusionData);

// fabric: pop the material changer transform
context.popTransform();
if (shouldTransform)
context.popTransform();
}

protected abstract void emitBlockQuadsInner(BlockAndTintGetter blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context, BlockState material, CullFaceRemovalData cullFaceRemovalData, OcclusionData occlusionData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import javax.annotation.Nullable;

import io.github.fabricators_of_create.porting_lib.event.common.LivingEntityEvents;
import io.github.fabricators_of_create.porting_lib.util.UsernameCache;

import org.apache.commons.lang3.tuple.Pair;
Expand Down Expand Up @@ -140,22 +141,22 @@ public static int deployerKillsDoNotSpawnXP(int i, Player player) {
return i;
}

public static void entitiesDontRetaliate(LivingEntity entityLiving, LivingEntity target) {
if (!(target instanceof DeployerFakePlayer))
public static void entitiesDontRetaliate(LivingEntityEvents.ChangeTarget.ChangeTargetEvent event) {
if (!(event.getOriginalTarget() instanceof DeployerFakePlayer))
return;
if (!(entityLiving instanceof Mob))
LivingEntity entityLiving = (LivingEntity) event.getEntity();
if (!(entityLiving instanceof Mob mob))
return;
Mob mob = (Mob) entityLiving;

CKinetics.DeployerAggroSetting setting = AllConfigs.server().kinetics.ignoreDeployerAttacks.get();

switch (setting) {
case ALL:
mob.setTarget(null);
event.setCanceled(true);
break;
case CREEPERS:
if (mob instanceof Creeper)
mob.setTarget(null);
event.setCanceled(true);
break;
case NONE:
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,9 @@ public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneak
boolean simplify = AllConfigs.client().simplifyFluidUnit.get();
for (SmartFluidTankBehaviour behaviour : tanks) {
for (TankSegment tank : behaviour.getTanks()) {
FluidStack fluidStack = tank.getRenderedFluid();
if (fluidStack.isEmpty()) {
FluidStack fluidStack = tank.getTank().getFluid();
if (fluidStack.isEmpty())
continue;
}
Lang.text("")
.add(Lang.fluidName(fluidStack)
.add(Lang.text(" "))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ public boolean isEmpty(float partialTicks) {
return false;
}

// fabric: expose for basin tooltips
public SmartFluidTank getTank() {
return tank;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ public static void register() {
AttackBlockCallback.EVENT.register(ZapperInteractionHandler::leftClickingBlocksWithTheZapperSelectsTheBlock);
UseEntityCallback.EVENT.register(ScheduleItemEntityInteraction::interactWithConductor);
ServerTickEvents.END_WORLD_TICK.register(HauntedBellPulser::hauntedBellCreatesPulse);
MobEntitySetTargetCallback.EVENT.register(DeployerFakePlayer::entitiesDontRetaliate);
MountEntityCallback.EVENT.register(CouplingHandler::preventEntitiesFromMoutingOccupiedCart);
LivingEntityEvents.EXPERIENCE_DROP.register(DeployerFakePlayer::deployerKillsDoNotSpawnXP);
LivingEntityEvents.ACTUALLY_HURT.register(ExtendoGripItem::bufferLivingAttackEvent);
Expand All @@ -300,6 +299,7 @@ public static void register() {
LivingEntityEvents.LOOTING_LEVEL.register(CrushingWheelBlockEntity::crushingIsFortunate);
LivingEntityEvents.DROPS.register(DeployerFakePlayer::deployerCollectsDropsFromKilledEntities);
LivingEntityEvents.EQUIPMENT_CHANGE.register(NetheriteDivingHandler::onLivingEquipmentChange);
LivingEntityEvents.CHANGE_TARGET.register(DeployerFakePlayer::entitiesDontRetaliate);
EntityEvents.EYE_HEIGHT.register(DeployerFakePlayer::deployerHasEyesOnHisFeet);
BlockEvents.POST_PROCESS_PLACE.register(SymmetryHandler::onBlockPlaced);
BlockEvents.POST_PROCESS_PLACE.register(SuperGlueHandler::glueListensForBlockPlacement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.jozufozu.flywheel.fabric.model.DefaultLayerFilteringBakedModel;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.simibubi.create.content.decoration.copycat.CopycatModel;
import com.simibubi.create.foundation.placement.PlacementHelpers;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
"create_interactive": "<=1.0.0-beta.3",
"garnished": "<=1.6.3",
"create_basic_additions": "<=1.0.1",
"createmorepotatoes": "<=1.0.3"
"createmorepotatoes": "<=1.0.3",
"extendedbogeys": "<=0.4.5"
},

"custom": {
Expand Down

0 comments on commit f8dcba4

Please sign in to comment.