-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Hephaestus-Dev/1.1.1
1.1.1
- Loading branch information
Showing
19 changed files
with
159 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/dev/hephaestus/tweaks/mixin/entity/GetHeldItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package dev.hephaestus.tweaks.mixin.entity; | ||
|
||
import dev.hephaestus.tweaks.util.ItemEntityShapeContext; | ||
import net.minecraft.block.EntityShapeContext; | ||
import net.minecraft.item.Item; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(EntityShapeContext.class) | ||
public class GetHeldItem implements ItemEntityShapeContext { | ||
@Shadow @Final private Item heldItem; | ||
|
||
@Override | ||
public Item getItem() { | ||
return this.heldItem; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/dev/hephaestus/tweaks/mixin/world/TickMore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package dev.hephaestus.tweaks.mixin.world; | ||
|
||
import dev.hephaestus.tweaks.Tweaks; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.fluid.FluidState; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.tag.BlockTags; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.ChunkPos; | ||
import net.minecraft.util.profiler.Profiler; | ||
import net.minecraft.util.registry.RegistryKey; | ||
import net.minecraft.world.MutableWorldProperties; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.chunk.ChunkSection; | ||
import net.minecraft.world.chunk.WorldChunk; | ||
import net.minecraft.world.dimension.DimensionType; | ||
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.LocalCapture; | ||
|
||
import java.util.function.Supplier; | ||
|
||
@Mixin(ServerWorld.class) | ||
public abstract class TickMore extends World { | ||
protected TickMore(MutableWorldProperties properties, RegistryKey<World> registryRef, DimensionType dimensionType, Supplier<Profiler> profiler, boolean isClient, boolean debugWorld, long seed) { | ||
super(properties, registryRef, dimensionType, profiler, isClient, debugWorld, seed); | ||
} | ||
|
||
@Inject(method = "tickChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/ChunkSection;getYOffset()I", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) | ||
private void tickMore(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci, ChunkPos chunkPos, boolean bl, int startX, int startZ, Profiler profiler, ChunkSection[] var8, int var9, int var10, ChunkSection chunkSection) { | ||
int startY = chunkSection.getYOffset(); | ||
|
||
for (int i = 0; i < randomTickSpeed; ++i) { | ||
for (int j = 0; j < Tweaks.CONFIG.leafDecaySpeed - 1; ++j) { | ||
BlockPos blockPos4 = this.getRandomPosInChunk(startX, startY, startZ, 15); | ||
profiler.push("randomTick"); | ||
BlockState blockState = chunkSection.getBlockState(blockPos4.getX() - startX, blockPos4.getY() - startY, blockPos4.getZ() - startZ); | ||
|
||
if (blockState.hasRandomTicks() && blockState.isIn(BlockTags.LEAVES)) { | ||
blockState.randomTick((ServerWorld) (Object) this, blockPos4, this.random); | ||
} | ||
|
||
profiler.pop(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/dev/hephaestus/tweaks/util/ItemEntityShapeContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package dev.hephaestus.tweaks.util; | ||
|
||
import net.minecraft.item.Item; | ||
|
||
public interface ItemEntityShapeContext { | ||
Item getItem(); | ||
} |
Oops, something went wrong.