Skip to content

Commit

Permalink
Backport to Minecraft 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
realguyman committed Apr 26, 2024
1 parent e4d1727 commit e11d8d6
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {
// Local dependencies
modLocalRuntime "com.terraformersmc:modmenu:${project.mod_menu}"
modLocalRuntime "maven.modrinth:lithium:${project.lithium}"
modLocalRuntime "dev.lambdaurora:lambdynamiclights:${project.lambdynamiclights}"
// modLocalRuntime "dev.lambdaurora:lambdynamiclights:${project.lambdynamiclights}"
// modLocalRuntime "vazkii.patchouli:Patchouli:${project.patchouli}"
// modLocalRuntime "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei}"
// modLocalRuntime "dev.emi:emi:${project.emi}"
Expand Down
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
org.gradle.jvmargs=-Xmx1G

# Required dependencies
minecraft=1.20.4
mappings=1.20.4+build.3
fabric_loader=0.15.9
fabric_api=0.96.11+1.20.4
owo_lib=0.12.6+1.20.3
minecraft=1.20.1
mappings=1.20.1+build.10
fabric_loader=0.15.10
fabric_api=0.92.1+1.20.1
owo_lib=0.11.2+1.20

# Local dependencies
mod_menu=9.0.0
lithium=mc1.20.4-0.12.1
lambdynamiclights=2.3.4+1.20.4-local
mod_menu=7.2.2
lithium=mc1.20.1-0.11.2
lambdynamiclights=2.3.2+1.20.1
patchouli=1.20.1-83-FABRIC
rei=13.0.678
emi=1.0.24+1.20.2+fabric

# Project details
mod_version=0.13.6+1.20.4
mod_version=0.13.6+1.20.1
maven_group=io.github.realguyman
archives_base_name=totally_lit
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
public class NoParticleTorchBlock extends TorchBlock {
public NoParticleTorchBlock(Settings settings) {
super(null, settings);
super(settings, null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
public class NoParticleWallTorchBlock extends WallTorchBlock {
public NoParticleWallTorchBlock(Settings settings) {
super(null, settings);
super(settings, null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.realguyman.totally_lit.TotallyLit;
import io.github.realguyman.totally_lit.access.CampfireBlockEntityAccess;
import java.util.List;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.CampfireBlock;
Expand Down Expand Up @@ -48,6 +49,8 @@ private void extinguish(BlockState state, ServerWorld world, BlockPos pos, Rando
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, SoundCategory.BLOCKS, 1.0F, 1.0F);
((CampfireBlockEntityAccess) blockEntity).totally_lit$setTicksBurntFor(0);
}

ci.cancel();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.github.realguyman.totally_lit.TotallyLit;
import io.github.realguyman.totally_lit.access.CampfireBlockEntityAccess;
import io.github.realguyman.totally_lit.registry.TagRegistry;
import java.util.List;
import net.minecraft.block.BlockState;
import net.minecraft.block.CampfireBlock;
import net.minecraft.block.entity.CampfireBlockEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(Block.class)
Expand All @@ -29,7 +30,7 @@ private void canSchedule(BlockState state, CallbackInfoReturnable<Boolean> cir)
}

@Inject(method = "onBreak", at = @At("HEAD"))
private void clearNextScheduledExtinguish(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfoReturnable<BlockState> cir) {
private void clearNextScheduledExtinguish(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfo ci) {
if (!world.isClient() && AbstractCandleBlock.isLitCandle(state)) {
((ServerWorld) world).getBlockTickScheduler().clearNextTicks(new BlockBox(pos));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.realguyman.totally_lit.mixin.candle;

import io.github.realguyman.totally_lit.TotallyLit;
import java.util.List;
import net.minecraft.block.*;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.predicate.entity.EntityPredicates;
Expand All @@ -21,7 +22,7 @@
public abstract class ScheduleMixin {
@Shadow public abstract void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random);

@Inject(method = "randomTick", at = @At("HEAD"))
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
private void schedule(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) {
if (!AbstractCandleBlock.isLitCandle(state)) {
return;
Expand All @@ -45,6 +46,8 @@ private void schedule(BlockState state, ServerWorld world, BlockPos pos, Random
world.scheduleBlockTick(pos, block, TotallyLit.CONFIG.candles.burnDuration());
}
}

ci.cancel();
}

@Inject(method = "scheduledTick", at = @At("HEAD"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(Block.class)
Expand All @@ -29,7 +30,7 @@ private void canSchedule(BlockState state, CallbackInfoReturnable<Boolean> cir)
}

@Inject(method = "onBreak", at = @At("HEAD"))
private void clearNextScheduledExtinguish(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfoReturnable<BlockState> cir) {
private void clearNextScheduledExtinguish(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfo ci) {
if (!world.isClient() && TotallyLit.JACK_O_LANTERN_MAP.containsKey(state.getBlock())) {
((ServerWorld) world).getBlockTickScheduler().clearNextTicks(new BlockBox(pos));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.realguyman.totally_lit.mixin.jack_o_lantern;

import io.github.realguyman.totally_lit.TotallyLit;
import java.util.List;
import net.minecraft.block.*;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.predicate.entity.EntityPredicates;
Expand All @@ -22,7 +23,7 @@
public abstract class ScheduleMixin {
@Shadow public abstract void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, net.minecraft.util.math.random.Random random);

@Inject(method = "randomTick", at = @At("HEAD"))
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
private void schedule(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) {
if (!TotallyLit.JACK_O_LANTERN_MAP.containsKey(state.getBlock())) {
return;
Expand All @@ -42,6 +43,8 @@ private void schedule(BlockState state, ServerWorld world, BlockPos pos, Random
world.scheduleBlockTick(pos, block, TotallyLit.CONFIG.jackOLanterns.burnDuration());
}
}

ci.cancel();
}

@Inject(method = "scheduledTick", at = @At("HEAD"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void extinguishWhenPlacedInWater(World world, BlockPos pos, BlockState s
}

@Inject(method = "onBreak", at = @At("HEAD"))
private void clearNextScheduledExtinguish(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfoReturnable<BlockState> cir) {
private void clearNextScheduledExtinguish(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfo ci) {
if (!world.isClient() && TotallyLit.LANTERN_MAP.containsKey(state.getBlock())) {
((ServerWorld) world).getBlockTickScheduler().clearNextTicks(new BlockBox(pos));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.realguyman.totally_lit.TotallyLit;
import io.github.realguyman.totally_lit.registry.TagRegistry;
import java.util.List;
import net.minecraft.block.*;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.VillagerEntity;
Expand All @@ -25,7 +26,7 @@
public abstract class ScheduleMixin {
@Shadow public abstract void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, net.minecraft.util.math.random.Random random);

@Inject(method = "randomTick", at = @At("HEAD"))
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
private void schedule(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) {
if (!TotallyLit.LANTERN_MAP.containsKey(state.getBlock())) {
return;
Expand All @@ -45,6 +46,8 @@ private void schedule(BlockState state, ServerWorld world, BlockPos pos, Random
world.scheduleBlockTick(pos, block, TotallyLit.CONFIG.lanterns.burnDuration());
}
}

ci.cancel();
}

@Inject(method = "scheduledTick", at = @At("HEAD"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(Block.class)
Expand All @@ -30,7 +31,7 @@ private void canSchedule(BlockState state, CallbackInfoReturnable<Boolean> cir)
}

@Inject(method = "onBreak", at = @At("HEAD"))
private void clearNextScheduledExtinguish(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfoReturnable<BlockState> cir) {
private void clearNextScheduledExtinguish(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfo ci) {
if (!world.isClient() && TotallyLit.TORCH_MAP.containsKey(state.getBlock())) {
((ServerWorld) world).getBlockTickScheduler().clearNextTicks(new BlockBox(pos));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.realguyman.totally_lit.TotallyLit;
import io.github.realguyman.totally_lit.registry.TagRegistry;
import java.util.List;
import net.minecraft.block.*;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.predicate.entity.EntityPredicates;
Expand All @@ -23,7 +24,7 @@
public abstract class ScheduleMixin {
@Shadow public abstract void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, net.minecraft.util.math.random.Random random);

@Inject(method = "randomTick", at = @At("HEAD"))
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
private void schedule(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) {
if (!TotallyLit.TORCH_MAP.containsKey(state.getBlock())) {
return;
Expand All @@ -43,6 +44,8 @@ private void schedule(BlockState state, ServerWorld world, BlockPos pos, Random
world.scheduleBlockTick(pos, block, TotallyLit.CONFIG.torches.burnDuration());
}
}

ci.cancel();
}

@Inject(method = "scheduledTick", at = @At("HEAD"))
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
},
"depends": {
"java": ">=17",
"minecraft": "1.20.4",
"minecraft": "1.20.1",
"fabricloader": ">=0.15.0",
"fabric-api": "*",
"owo-lib": ">=0.12.0"
"owo-lib": ">=0.11.0"
},
"breaks": {
"hardcore_torches": "*"
Expand Down

0 comments on commit e11d8d6

Please sign in to comment.