Skip to content

Commit 112b906

Browse files
committed
Fix running dedicated server
1 parent 6f0eb23 commit 112b906

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ build
2626
# other
2727
eclipse
2828
run
29+
run-server
2930

3031
# Files from Forge MDK
3132
forge*changelog.txt

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ minecraft {
107107
}
108108

109109
server {
110-
workingDirectory project.file('run')
110+
workingDirectory project.file('run-server')
111111

112112
property 'forge.logging.markers', 'REGISTRIES'
113113
property 'forge.logging.console.level', 'debug'

src/machines/java/com/enderio/machines/common/recipe/SoulBindingRecipe.java

+14-6
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,19 @@ public SoulBindingRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf
217217
int exp = buffer.readInt();
218218

219219
ResourceLocation entityType = null;
220-
try { //fails if not present
221-
entityType = buffer.readResourceLocation();
222-
} catch (Exception ignored) {
220+
if (buffer.readBoolean()) {
221+
try { //fails if not present
222+
entityType = buffer.readResourceLocation();
223+
} catch (Exception ignored) {
224+
}
223225
}
224226

225227
MobCategory mobCategory = null;
226-
try { //fails if not present
227-
mobCategory = MobCategory.byName(buffer.readUtf());
228-
} catch (Exception ignored) {
228+
if (buffer.readBoolean()) {
229+
try { //fails if not present
230+
mobCategory = MobCategory.byName(buffer.readUtf());
231+
} catch (Exception ignored) {
232+
}
229233
}
230234

231235
return new SoulBindingRecipe(recipeId, output, input, energy, exp, entityType, mobCategory);
@@ -242,9 +246,13 @@ public void toNetwork(FriendlyByteBuf buffer, SoulBindingRecipe recipe) {
242246
recipe.input.toNetwork(buffer);
243247
buffer.writeInt(recipe.energy);
244248
buffer.writeInt(recipe.exp);
249+
250+
buffer.writeBoolean(recipe.entityType != null);
245251
if (recipe.entityType != null) { //don't write null
246252
buffer.writeResourceLocation(recipe.entityType);
247253
}
254+
255+
buffer.writeBoolean(recipe.mobCategory != null);
248256
if (recipe.mobCategory != null) { //don't write null
249257
buffer.writeUtf(recipe.mobCategory.getName());
250258
}

src/main/java/com/enderio/base/common/recipe/ShapedEntityStorageRecipe.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ShapedEntityStorageRecipe extends ShapedRecipe {
2828

2929
public ShapedEntityStorageRecipe(ShapedRecipe recipe) {
3030
super(recipe.getId(), recipe.getGroup(), recipe.category(), recipe.getRecipeWidth(), recipe.getRecipeHeight(), recipe.getIngredients(),
31-
recipe.getResultItem(Minecraft.getInstance().level != null ? Minecraft.getInstance().level.registryAccess() : null)); // Gross, but better than always passing null
31+
recipe.result); // Gross, but better than always passing null
3232

3333
REGISTERED_RECIPES.add(recipe.getId());
3434
}

src/main/resources/META-INF/accesstransformer.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ public-f net.minecraft.client.renderer.MultiBufferSource$BufferSource f_109905_
2727
public net.minecraft.data.recipes.SimpleCookingRecipeBuilder m_247292_(Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/world/item/crafting/CookingBookCategory; # determineSmeltingRecipeCategory
2828
public net.minecraft.data.recipes.SimpleCookingRecipeBuilder m_246122_(Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/world/item/crafting/CookingBookCategory; # determineBlastingRecipeCategory
2929
public net.minecraft.data.recipes.SimpleCookingRecipeBuilder m_246784_(Lnet/minecraft/world/item/crafting/RecipeSerializer;Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/world/item/crafting/CookingBookCategory; # determineRecipeCategory
30+
31+
# For passing to our wrapped recipe
32+
public-f net.minecraft.world.item.crafting.ShapedRecipe f_44149_ # result

0 commit comments

Comments
 (0)