Skip to content

Commit 3764002

Browse files
committed
add assets
1 parent bab6698 commit 3764002

Some content is hidden

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

55 files changed

+360
-16
lines changed

common/src/main/java/com/github/litermc/vsmecha/VSMechaRegistry.java

Lines changed: 109 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,38 @@ public static void register() {
4646
public static final class Blocks {
4747
private static final RegistrationHelper<Block> REGISTRY = PlatformHelper.get().createRegistrationHelper(Registries.BLOCK);
4848

49+
public static final RegistryEntry<StainedToolBlock> WHITE_TOOL_BLOCK =
50+
REGISTRY.register("white_tool_block", () -> new StainedToolBlock(DyeColor.WHITE, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.WHITE_CONCRETE)));
51+
public static final RegistryEntry<StainedToolBlock> ORANGE_TOOL_BLOCK =
52+
REGISTRY.register("orange_tool_block", () -> new StainedToolBlock(DyeColor.ORANGE, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.ORANGE_CONCRETE)));
53+
public static final RegistryEntry<StainedToolBlock> MAGENTA_TOOL_BLOCK =
54+
REGISTRY.register("magenta_tool_block", () -> new StainedToolBlock(DyeColor.MAGENTA, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.MAGENTA_CONCRETE)));
55+
public static final RegistryEntry<StainedToolBlock> LIGHT_BLUE_TOOL_BLOCK =
56+
REGISTRY.register("light_blue_tool_block", () -> new StainedToolBlock(DyeColor.LIGHT_BLUE, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_CONCRETE)));
57+
public static final RegistryEntry<StainedToolBlock> YELLOW_TOOL_BLOCK =
58+
REGISTRY.register("yellow_tool_block", () -> new StainedToolBlock(DyeColor.YELLOW, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.YELLOW_CONCRETE)));
59+
public static final RegistryEntry<StainedToolBlock> LIME_TOOL_BLOCK =
60+
REGISTRY.register("lime_tool_block", () -> new StainedToolBlock(DyeColor.LIME, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.LIME_CONCRETE)));
61+
public static final RegistryEntry<StainedToolBlock> PINK_TOOL_BLOCK =
62+
REGISTRY.register("pink_tool_block", () -> new StainedToolBlock(DyeColor.PINK, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.PINK_CONCRETE)));
63+
public static final RegistryEntry<StainedToolBlock> GRAY_TOOL_BLOCK =
64+
REGISTRY.register("gray_tool_block", () -> new StainedToolBlock(DyeColor.GRAY, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.GRAY_CONCRETE)));
65+
public static final RegistryEntry<StainedToolBlock> LIGHT_GRAY_TOOL_BLOCK =
66+
REGISTRY.register("light_gray_tool_block", () -> new StainedToolBlock(DyeColor.LIGHT_GRAY, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_CONCRETE)));
67+
public static final RegistryEntry<StainedToolBlock> CYAN_TOOL_BLOCK =
68+
REGISTRY.register("cyan_tool_block", () -> new StainedToolBlock(DyeColor.CYAN, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.CYAN_CONCRETE)));
69+
public static final RegistryEntry<StainedToolBlock> PURPLE_TOOL_BLOCK =
70+
REGISTRY.register("purple_tool_block", () -> new StainedToolBlock(DyeColor.PURPLE, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.PURPLE_CONCRETE)));
71+
public static final RegistryEntry<StainedToolBlock> BLUE_TOOL_BLOCK =
72+
REGISTRY.register("blue_tool_block", () -> new StainedToolBlock(DyeColor.BLUE, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.BLUE_CONCRETE)));
73+
public static final RegistryEntry<StainedToolBlock> BROWN_TOOL_BLOCK =
74+
REGISTRY.register("brown_tool_block", () -> new StainedToolBlock(DyeColor.BROWN, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.BROWN_CONCRETE)));
75+
public static final RegistryEntry<StainedToolBlock> GREEN_TOOL_BLOCK =
76+
REGISTRY.register("green_tool_block", () -> new StainedToolBlock(DyeColor.GREEN, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.GREEN_CONCRETE)));
77+
public static final RegistryEntry<StainedToolBlock> RED_TOOL_BLOCK =
78+
REGISTRY.register("red_tool_block", () -> new StainedToolBlock(DyeColor.RED, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.RED_CONCRETE)));
4979
public static final RegistryEntry<StainedToolBlock> BLACK_TOOL_BLOCK =
50-
REGISTRY.register("black_tool_block", () -> new StainedToolBlock(DyeColor.BLACK, BlockBehaviour.Properties.of()));
80+
REGISTRY.register("black_tool_block", () -> new StainedToolBlock(DyeColor.BLACK, BlockBehaviour.Properties.copy(net.minecraft.world.level.block.Blocks.BLACK_CONCRETE)));
5181

5282
public static void onRegisterRenderType(final BiConsumer<Block, RenderType> consumer) {
5383
}
@@ -69,7 +99,24 @@ private static <T extends BlockEntity> RegistryEntry<BlockEntityType<T>> of(fina
6999
}
70100

71101
public static final RegistryEntry<BlockEntityType<ToolBaseBlockEntity>> TOOL_BASE =
72-
of("tool_base", ToolBaseBlockEntity::new, Blocks.BLACK_TOOL_BLOCK);
102+
of("tool_base", ToolBaseBlockEntity::new,
103+
Blocks.WHITE_TOOL_BLOCK,
104+
Blocks.ORANGE_TOOL_BLOCK,
105+
Blocks.MAGENTA_TOOL_BLOCK,
106+
Blocks.LIGHT_BLUE_TOOL_BLOCK,
107+
Blocks.YELLOW_TOOL_BLOCK,
108+
Blocks.LIME_TOOL_BLOCK,
109+
Blocks.PINK_TOOL_BLOCK,
110+
Blocks.GRAY_TOOL_BLOCK,
111+
Blocks.LIGHT_GRAY_TOOL_BLOCK,
112+
Blocks.CYAN_TOOL_BLOCK,
113+
Blocks.PURPLE_TOOL_BLOCK,
114+
Blocks.BLUE_TOOL_BLOCK,
115+
Blocks.BROWN_TOOL_BLOCK,
116+
Blocks.GREEN_TOOL_BLOCK,
117+
Blocks.RED_TOOL_BLOCK,
118+
Blocks.BLACK_TOOL_BLOCK
119+
);
73120

74121
private BlockEntities() {}
75122
}
@@ -92,6 +139,66 @@ private static <B extends Block, I extends Item> RegistryEntry<I> ofBlock(Regist
92139
return entry;
93140
}
94141

142+
public static final RegistryEntry<BlockItem> WHITE_TOOL_BLOCK = ofBlock(
143+
Blocks.WHITE_TOOL_BLOCK,
144+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
145+
);
146+
public static final RegistryEntry<BlockItem> ORANGE_TOOL_BLOCK = ofBlock(
147+
Blocks.ORANGE_TOOL_BLOCK,
148+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
149+
);
150+
public static final RegistryEntry<BlockItem> MAGENTA_TOOL_BLOCK = ofBlock(
151+
Blocks.MAGENTA_TOOL_BLOCK,
152+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
153+
);
154+
public static final RegistryEntry<BlockItem> LIGHT_BLUE_TOOL_BLOCK = ofBlock(
155+
Blocks.LIGHT_BLUE_TOOL_BLOCK,
156+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
157+
);
158+
public static final RegistryEntry<BlockItem> YELLOW_TOOL_BLOCK = ofBlock(
159+
Blocks.YELLOW_TOOL_BLOCK,
160+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
161+
);
162+
public static final RegistryEntry<BlockItem> LIME_TOOL_BLOCK = ofBlock(
163+
Blocks.LIME_TOOL_BLOCK,
164+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
165+
);
166+
public static final RegistryEntry<BlockItem> PINK_TOOL_BLOCK = ofBlock(
167+
Blocks.PINK_TOOL_BLOCK,
168+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
169+
);
170+
public static final RegistryEntry<BlockItem> GRAY_TOOL_BLOCK = ofBlock(
171+
Blocks.GRAY_TOOL_BLOCK,
172+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
173+
);
174+
public static final RegistryEntry<BlockItem> LIGHT_GRAY_TOOL_BLOCK = ofBlock(
175+
Blocks.LIGHT_GRAY_TOOL_BLOCK,
176+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
177+
);
178+
public static final RegistryEntry<BlockItem> CYAN_TOOL_BLOCK = ofBlock(
179+
Blocks.CYAN_TOOL_BLOCK,
180+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
181+
);
182+
public static final RegistryEntry<BlockItem> PURPLE_TOOL_BLOCK = ofBlock(
183+
Blocks.PURPLE_TOOL_BLOCK,
184+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
185+
);
186+
public static final RegistryEntry<BlockItem> BLUE_TOOL_BLOCK = ofBlock(
187+
Blocks.BLUE_TOOL_BLOCK,
188+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
189+
);
190+
public static final RegistryEntry<BlockItem> BROWN_TOOL_BLOCK = ofBlock(
191+
Blocks.BROWN_TOOL_BLOCK,
192+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
193+
);
194+
public static final RegistryEntry<BlockItem> GREEN_TOOL_BLOCK = ofBlock(
195+
Blocks.GREEN_TOOL_BLOCK,
196+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
197+
);
198+
public static final RegistryEntry<BlockItem> RED_TOOL_BLOCK = ofBlock(
199+
Blocks.RED_TOOL_BLOCK,
200+
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
201+
);
95202
public static final RegistryEntry<BlockItem> BLACK_TOOL_BLOCK = ofBlock(
96203
Blocks.BLACK_TOOL_BLOCK,
97204
(block, props) -> new BlockItem(block, props.rarity(Rarity.UNCOMMON).stacksTo(16))
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.github.litermc.vsmecha.shape;
2+
3+
import net.minecraft.world.level.block.state.BlockState;
4+
import net.minecraft.server.level.ServerLevel;
5+
6+
import org.joml.Vector3dc;
7+
8+
public interface IToolShape {
9+
boolean isCorrectToolForDrops(BlockState state);
10+
11+
boolean test(ServerLevel level, Vector3dc pos, Vector3dc reaction);
12+
}

common/src/main/java/com/github/litermc/vsmecha/util/DestroyUtil.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public static boolean impact(final ServerLevel level, final BlockPos pos, final
4343
if (!tryDestroy(level, pos, player)) {
4444
return false;
4545
}
46-
System.out.println("destroying: " + pos);
4746
level.destroyBlock(pos, true, player);
4847
return true;
4948
}
@@ -61,7 +60,6 @@ private static boolean tryDestroy(final ServerLevel level, final BlockPos pos, f
6160
return true;
6261
}
6362
final float inc = state.getDestroyProgress(player, level, pos);
64-
System.out.println("breaking: " + pos + " inc: " + inc);
6563
return addDestroyProgress(level, pos, inc);
6664
}
6765

@@ -76,26 +74,27 @@ public static boolean addDestroyProgress(final ServerLevel level, final BlockPos
7674
final DestroyData data = DestroyData.get(level);
7775
final long longPos = pos.asLong();
7876
final float newProg = data.destroyProgress.addTo(longPos, inc) + inc;
79-
System.out.println("newProg: " + pos + ": " + newProg);
8077
data.recentlyActive.add(longPos);
8178
if (newProg < 1) {
82-
level.destroyBlockProgress(-1, pos, (int) (newProg * 10));
79+
level.destroyBlockProgress(-(pos.hashCode() & 0xfffffff), pos, (int) (newProg * 10));
8380
return false;
8481
}
85-
level.destroyBlockProgress(-1, pos, -1);
82+
level.destroyBlockProgress(-(pos.hashCode() & 0xfffffff), pos, -1);
8683
data.destroyProgress.remove(longPos);
8784
data.recentlyActive.remove(longPos);
8885
return true;
8986
}
9087

9188
private static void refreshDestroyProgresses(final ServerLevel level) {
9289
final DestroyData data = DestroyData.get(level);
93-
for (final long pos : data.destroyProgress.keySet()) {
94-
if (!data.recentlyActive.contains(pos)) {
95-
level.destroyBlockProgress(-1, BlockPos.of(pos), -1);
96-
data.destroyProgress.remove(pos);
90+
data.destroyProgress.keySet().removeIf((pos) -> {
91+
if (data.recentlyActive.contains(pos)) {
92+
return false;
9793
}
98-
}
94+
final BlockPos bpos = BlockPos.of(pos);
95+
level.destroyBlockProgress(-(bpos.hashCode() & 0xfffffff), bpos, -1);
96+
return true;
97+
});
9998
final int oldSize = data.recentlyActive.size();
10099
data.recentlyActive.clear();
101100
data.recentlyActive.trim(oldSize);

common/src/main/java/com/github/litermc/vsmecha/util/PredictUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public final class PredictUtil {
2020
private static final double[] PREDICT_SCALES = new double[PREDICT_STEPS];
2121
static {
2222
for (int i = 0; i < PREDICT_STEPS; i++) {
23-
PREDICT_SCALES[i] = 1 + (i + 1.0) / 4;
23+
PREDICT_SCALES[i] = 1 + (i + 1.0) / 2;
2424
}
2525
}
2626
private static final Map<Long, PredictData> PREDICT_CACHES = new HashMap<>();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "vsmecha:block/black_tool_block"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "vsmecha:block/blue_tool_block"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "vsmecha:block/brown_tool_block"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "vsmecha:block/cyan_tool_block"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "vsmecha:block/gray_tool_block"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "vsmecha:block/green_tool_block"
5+
}
6+
}
7+
}

0 commit comments

Comments
 (0)