Skip to content

Commit 7e0f567

Browse files
committed
Change Yarn mapppings to offical mappings
1 parent db0cbd9 commit 7e0f567

File tree

597 files changed

+19121
-18929
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

597 files changed

+19121
-18929
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fabricApi {
6464
dependencies {
6565
// To change the versions see the gradle.properties file
6666
minecraft "com.mojang:minecraft:${project.minecraft_version}"
67-
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
67+
mappings loom.officialMojangMappings()
6868
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
6969

7070
// Fabric API. This is technically optional, but you probably want it anyway.

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ org.gradle.debug=false
66
# Fabric Properties
77
# check these on https://fabricmc.net/develop
88
minecraft_version=1.21.11
9-
yarn_mappings=1.21.11+build.1
109
loader_version=0.18.1
1110

1211
# Mod Properties

src/main/java/me/jddev0/ep/EnergizedPowerMod.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
2626
import net.fabricmc.fabric.api.recipe.v1.sync.RecipeSynchronization;
2727
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
28-
import net.minecraft.item.Item;
29-
import net.minecraft.item.ItemGroup;
30-
import net.minecraft.item.ItemStack;
31-
import net.minecraft.registry.RegistryKey;
32-
28+
import net.minecraft.resources.ResourceKey;
29+
import net.minecraft.world.item.CreativeModeTab;
30+
import net.minecraft.world.item.Item;
31+
import net.minecraft.world.item.ItemStack;
3332
import java.util.function.Consumer;
3433

3534
public class EnergizedPowerMod implements ModInitializer {
@@ -380,7 +379,7 @@ private void addCreativeTab() {
380379
});
381380
}
382381

383-
private void addCreativeTabFor(RegistryKey<ItemGroup> groupKey,
382+
private void addCreativeTabFor(ResourceKey<CreativeModeTab> groupKey,
384383
Consumer<CreativeTabEntriesHelper> consumer) {
385384
ItemGroupEvents.modifyEntriesEvent(groupKey).
386385
register(entries -> consumer.accept(new CreativeTabEntriesHelper(entries)));

src/main/java/me/jddev0/ep/EnergizedPowerModClient.java

Lines changed: 119 additions & 119 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package me.jddev0.ep.api;
22

3-
import net.minecraft.util.Identifier;
3+
import net.minecraft.resources.Identifier;
44

55
public final class EPAPI {
66
private EPAPI() {}
77

88
public static final String MOD_ID = "energizedpower";
99

1010
public static Identifier id(String path) {
11-
return Identifier.of(MOD_ID, path);
11+
return Identifier.fromNamespaceAndPath(MOD_ID, path);
1212
}
1313
}

src/main/java/me/jddev0/ep/block/AdvancedAutoCrafterBlock.java

Lines changed: 64 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,136 +4,139 @@
44
import me.jddev0.ep.block.entity.AdvancedAutoCrafterBlockEntity;
55
import me.jddev0.ep.block.entity.EPBlockEntities;
66
import me.jddev0.ep.util.EnergyUtils;
7-
import net.minecraft.block.*;
8-
import net.minecraft.block.entity.BlockEntity;
9-
import net.minecraft.block.entity.BlockEntityTicker;
10-
import net.minecraft.block.entity.BlockEntityType;
11-
import net.minecraft.client.MinecraftClient;
12-
import net.minecraft.client.MinecraftClient;
13-
import net.minecraft.component.type.TooltipDisplayComponent;
14-
import net.minecraft.entity.player.PlayerEntity;
15-
import net.minecraft.item.BlockItem;
16-
import net.minecraft.item.ItemPlacementContext;
17-
import net.minecraft.item.ItemStack;
18-
import net.minecraft.item.tooltip.TooltipType;
19-
import net.minecraft.server.world.ServerWorld;
20-
import net.minecraft.state.StateManager;
21-
import net.minecraft.state.property.BooleanProperty;
22-
import net.minecraft.state.property.Properties;
23-
import net.minecraft.text.Text;
24-
import net.minecraft.util.ActionResult;
25-
import net.minecraft.util.Formatting;
26-
import net.minecraft.util.ItemScatterer;
27-
import net.minecraft.util.hit.BlockHitResult;
28-
import net.minecraft.util.math.BlockPos;
29-
import net.minecraft.util.math.Direction;
30-
import net.minecraft.world.World;
31-
import net.minecraft.world.block.WireOrientation;
7+
import net.minecraft.ChatFormatting;
8+
import net.minecraft.client.Minecraft;
9+
import net.minecraft.core.BlockPos;
10+
import net.minecraft.core.Direction;
11+
import net.minecraft.network.chat.Component;
12+
import net.minecraft.server.level.ServerLevel;
13+
import net.minecraft.world.Containers;
14+
import net.minecraft.world.InteractionResult;
15+
import net.minecraft.world.entity.player.Player;
16+
import net.minecraft.world.item.BlockItem;
17+
import net.minecraft.world.item.ItemStack;
18+
import net.minecraft.world.item.TooltipFlag;
19+
import net.minecraft.world.item.component.TooltipDisplay;
20+
import net.minecraft.world.item.context.BlockPlaceContext;
21+
import net.minecraft.world.level.Level;
22+
import net.minecraft.world.level.block.BaseEntityBlock;
23+
import net.minecraft.world.level.block.Block;
24+
import net.minecraft.world.level.block.RenderShape;
25+
import net.minecraft.world.level.block.entity.BlockEntity;
26+
import net.minecraft.world.level.block.entity.BlockEntityTicker;
27+
import net.minecraft.world.level.block.entity.BlockEntityType;
28+
import net.minecraft.world.level.block.state.BlockBehaviour;
29+
import net.minecraft.world.level.block.state.BlockState;
30+
import net.minecraft.world.level.block.state.StateDefinition;
31+
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
32+
import net.minecraft.world.level.block.state.properties.BooleanProperty;
33+
import net.minecraft.world.level.redstone.Orientation;
34+
import net.minecraft.world.phys.BlockHitResult;
3235
import org.jetbrains.annotations.Nullable;
3336

3437
import java.util.List;
3538
import java.util.function.Consumer;
3639

37-
public class AdvancedAutoCrafterBlock extends BlockWithEntity {
38-
public static final MapCodec<AdvancedAutoCrafterBlock> CODEC = createCodec(AdvancedAutoCrafterBlock::new);
40+
public class AdvancedAutoCrafterBlock extends BaseEntityBlock {
41+
public static final MapCodec<AdvancedAutoCrafterBlock> CODEC = simpleCodec(AdvancedAutoCrafterBlock::new);
3942

40-
public static final BooleanProperty POWERED = Properties.POWERED;
43+
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
4144

42-
public AdvancedAutoCrafterBlock(AbstractBlock.Settings props) {
45+
public AdvancedAutoCrafterBlock(BlockBehaviour.Properties props) {
4346
super(props);
4447

45-
this.setDefaultState(this.getStateManager().getDefaultState().with(POWERED, false));
48+
this.registerDefaultState(this.getStateDefinition().any().setValue(POWERED, false));
4649
}
4750

4851
@Override
49-
protected MapCodec<? extends BlockWithEntity> getCodec() {
52+
protected MapCodec<? extends BaseEntityBlock> codec() {
5053
return CODEC;
5154
}
5255

5356
@Nullable
5457
@Override
55-
public BlockEntity createBlockEntity(BlockPos blockPos, BlockState state) {
58+
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState state) {
5659
return new AdvancedAutoCrafterBlockEntity(blockPos, state);
5760
}
5861

5962
@Override
60-
public BlockRenderType getRenderType(BlockState state) {
61-
return BlockRenderType.MODEL;
63+
public RenderShape getRenderShape(BlockState state) {
64+
return RenderShape.MODEL;
6265
}
6366

6467
@Override
65-
public boolean hasComparatorOutput(BlockState state) {
68+
public boolean hasAnalogOutputSignal(BlockState state) {
6669
return true;
6770
}
6871

6972
@Override
70-
protected int getComparatorOutput(BlockState state, World level, BlockPos blockPos, Direction direction) {
73+
protected int getAnalogOutputSignal(BlockState state, Level level, BlockPos blockPos, Direction direction) {
7174
BlockEntity blockEntity = level.getBlockEntity(blockPos);
7275
if(!(blockEntity instanceof AdvancedAutoCrafterBlockEntity advancedAutoCrafterBlockEntity))
73-
return super.getComparatorOutput(state, level, blockPos, direction);
76+
return super.getAnalogOutputSignal(state, level, blockPos, direction);
7477

7578
return advancedAutoCrafterBlockEntity.getRedstoneOutput();
7679
}
7780

7881
@Override
79-
protected void onStateReplaced(BlockState state, ServerWorld level, BlockPos blockPos, boolean moved) {
80-
ItemScatterer.onStateReplaced(state, level, blockPos);
82+
protected void affectNeighborsAfterRemoval(BlockState state, ServerLevel level, BlockPos blockPos, boolean moved) {
83+
Containers.updateNeighboursAfterDestroy(state, level, blockPos);
8184
}
8285

8386
@Override
84-
public ActionResult onUse(BlockState state, World level, BlockPos blockPos, PlayerEntity player, BlockHitResult hit) {
85-
if(level.isClient())
86-
return ActionResult.SUCCESS;
87+
public InteractionResult useWithoutItem(BlockState state, Level level, BlockPos blockPos, Player player, BlockHitResult hit) {
88+
if(level.isClientSide())
89+
return InteractionResult.SUCCESS;
8790

8891
BlockEntity blockEntity = level.getBlockEntity(blockPos);
8992
if(!(blockEntity instanceof AdvancedAutoCrafterBlockEntity))
9093
throw new IllegalStateException("Container is invalid");
9194

92-
player.openHandledScreen((AdvancedAutoCrafterBlockEntity)blockEntity);
95+
player.openMenu((AdvancedAutoCrafterBlockEntity)blockEntity);
9396

94-
return ActionResult.SUCCESS;
97+
return InteractionResult.SUCCESS;
9598
}
9699

97100
@Override
98-
public void neighborUpdate(BlockState selfState, World level, BlockPos selfPos, Block fromBlock, @Nullable WireOrientation wireOrientation, boolean isMoving) {
99-
super.neighborUpdate(selfState, level, selfPos, fromBlock, wireOrientation, isMoving);
101+
public void neighborChanged(BlockState selfState, Level level, BlockPos selfPos, Block fromBlock, @Nullable Orientation wireOrientation, boolean isMoving) {
102+
super.neighborChanged(selfState, level, selfPos, fromBlock, wireOrientation, isMoving);
100103

101-
if(level.isClient())
104+
if(level.isClientSide())
102105
return;
103106

104-
boolean isPowered = level.isReceivingRedstonePower(selfPos);
105-
if(isPowered != selfState.get(POWERED))
106-
level.setBlockState(selfPos, selfState.with(POWERED, isPowered), 3);
107+
boolean isPowered = level.hasNeighborSignal(selfPos);
108+
if(isPowered != selfState.getValue(POWERED))
109+
level.setBlock(selfPos, selfState.setValue(POWERED, isPowered), 3);
107110
}
108111

109112
@Override
110-
public BlockState getPlacementState(ItemPlacementContext context) {
111-
return this.getDefaultState().with(POWERED, context.getWorld().isReceivingRedstonePower(context.getBlockPos()));
113+
public BlockState getStateForPlacement(BlockPlaceContext context) {
114+
return this.defaultBlockState().setValue(POWERED, context.getLevel().hasNeighborSignal(context.getClickedPos()));
112115
}
113116

114117
@Override
115-
protected void appendProperties(StateManager.Builder<Block, BlockState> stateBuilder) {
118+
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateBuilder) {
116119
stateBuilder.add(POWERED);
117120
}
118121

119122
@Nullable
120123
@Override
121-
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World level, BlockState state, BlockEntityType<T> type) {
122-
return validateTicker(type, EPBlockEntities.ADVANCED_AUTO_CRAFTER_ENTITY, AdvancedAutoCrafterBlockEntity::tick);
124+
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
125+
return createTickerHelper(type, EPBlockEntities.ADVANCED_AUTO_CRAFTER_ENTITY, AdvancedAutoCrafterBlockEntity::tick);
123126
}
124127

125128
public static class Item extends BlockItem {
126-
public Item(Block block, Item.Settings props) {
129+
public Item(Block block, Properties props) {
127130
super(block, props);
128131
}
129132

130133
@Override
131-
public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer<Text> tooltip, TooltipType type) {
132-
if(MinecraftClient.getInstance().isShiftPressed()) {
133-
tooltip.accept(Text.translatable("tooltip.energizedpower.auto_crafter.txt.shift.1",
134-
EnergyUtils.getEnergyWithPrefix(AdvancedAutoCrafterBlockEntity.ENERGY_CONSUMPTION_PER_TICK_PER_INGREDIENT)).formatted(Formatting.GRAY));
134+
public void appendHoverText(ItemStack stack, TooltipContext context, TooltipDisplay displayComponent, Consumer<Component> tooltip, TooltipFlag type) {
135+
if(Minecraft.getInstance().hasShiftDown()) {
136+
tooltip.accept(Component.translatable("tooltip.energizedpower.auto_crafter.txt.shift.1",
137+
EnergyUtils.getEnergyWithPrefix(AdvancedAutoCrafterBlockEntity.ENERGY_CONSUMPTION_PER_TICK_PER_INGREDIENT)).withStyle(ChatFormatting.GRAY));
135138
}else {
136-
tooltip.accept(Text.translatable("tooltip.energizedpower.shift_details.txt").formatted(Formatting.YELLOW));
139+
tooltip.accept(Component.translatable("tooltip.energizedpower.shift_details.txt").withStyle(ChatFormatting.YELLOW));
137140
}
138141
}
139142
}

0 commit comments

Comments
 (0)