generated from NeoForgeMDKs/MDK-1.21-ModDevGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mixins for chunk loading Updated steel armor textures Signed-off-by: SuperScary
- Loading branch information
1 parent
386e350
commit 1566ceb
Showing
21 changed files
with
147 additions
and
8 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
39 changes: 39 additions & 0 deletions
39
src/main/java/net/superscary/fluxmachines/hook/RedstoneHook.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,39 @@ | ||
package net.superscary.fluxmachines.hook; | ||
|
||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.InteractionResult; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.RedStoneWireBlock; | ||
import net.minecraft.world.level.block.state.properties.BlockStateProperties; | ||
import net.minecraft.world.phys.BlockHitResult; | ||
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; | ||
import net.superscary.fluxmachines.registries.FMItems; | ||
|
||
// TODO: Redstone signal not working on right click | ||
public class RedstoneHook { | ||
|
||
public static void onPlayerUseBlockEvent (PlayerInteractEvent.RightClickBlock event) { | ||
if (event.isCanceled()) return; | ||
onPlayerUseBlock(event.getEntity(), event.getLevel(), event.getHand(), event.getHitVec()); | ||
} | ||
|
||
public static InteractionResult onPlayerUseBlock (Player player, Level level, InteractionHand hand, BlockHitResult hitResult) { | ||
if (player.isSpectator() || hand != InteractionHand.MAIN_HAND) return InteractionResult.PASS; | ||
var itemStack = player.getItemInHand(hand); | ||
var blockpos = hitResult.getBlockPos(); | ||
|
||
if (level.getBlockState(hitResult.getBlockPos()).getBlock() instanceof RedStoneWireBlock block && itemStack.is(FMItems.REDSTONE_AND_STEEL.asItem())) { | ||
var state = level.getBlockState(hitResult.getBlockPos()); | ||
if (state.hasProperty(BlockStateProperties.POWER)) { | ||
state.setValue(BlockStateProperties.POWER, 15); | ||
level.updateNeighborsAt(blockpos, block); | ||
return InteractionResult.SUCCESS; | ||
} | ||
} | ||
|
||
return InteractionResult.PASS; | ||
} | ||
|
||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/net/superscary/fluxmachines/item/tool/RSItem.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,11 @@ | ||
package net.superscary.fluxmachines.item.tool; | ||
|
||
import net.superscary.fluxmachines.item.base.BaseItem; | ||
|
||
public class RSItem extends BaseItem { | ||
|
||
public RSItem (Properties properties) { | ||
super(properties.durability(64)); | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/net/superscary/fluxmachines/mixins/chunkloading/ChunkMapMixin.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,27 @@ | ||
package net.superscary.fluxmachines.mixins.chunkloading; | ||
|
||
import net.minecraft.server.level.ChunkMap; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.level.ChunkPos; | ||
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; | ||
|
||
@Mixin(ChunkMap.class) | ||
public class ChunkMapMixin { | ||
|
||
@Shadow | ||
@Final | ||
ServerLevel level; | ||
|
||
@Inject(at = @At("RETURN"), method = "anyPlayerCloseEnoughForSpawning", cancellable = true) | ||
private void forceLoad (ChunkPos pos, CallbackInfoReturnable<Boolean> ci) { | ||
if (!ci.getReturnValue()) { | ||
ci.setReturnValue(true); | ||
} | ||
} | ||
|
||
} |
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
Binary file added
BIN
+188 Bytes
src/main/resources/assets/fluxmachines/textures/item/redstone_and_steel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+48 Bytes
(120%)
src/main/resources/assets/fluxmachines/textures/item/steel_boots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-40 Bytes
(86%)
src/main/resources/assets/fluxmachines/textures/item/steel_chestplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+47 Bytes
(120%)
src/main/resources/assets/fluxmachines/textures/item/steel_helmet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.11 KB
(21%)
src/main/resources/assets/fluxmachines/textures/item/steel_ingot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+65 Bytes
(130%)
src/main/resources/assets/fluxmachines/textures/item/steel_leggings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,13 @@ | ||
{ | ||
"required": true, | ||
"package": "net.superscary.fluxmachines.mixins", | ||
"compatibilityLevel": "JAVA_21", | ||
"mixins": [ | ||
"chunkloading.ChunkMapMixin" | ||
], | ||
"client": [ | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
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