Fix lighting not being sent to client when large amounts of blocks change at once. Closes #5839

Remove RecipeType/VanillaRecipeTypes, as 1.14 has a vanilla system for this.
This commit is contained in:
LexManos 2019-06-19 18:10:02 -07:00
parent f01b87fac7
commit a14c2233e0
3 changed files with 10 additions and 121 deletions

View File

@ -18,7 +18,16 @@
this.field_219320_o[this.field_219321_p++] = short1;
}
@@ -177,20 +179,22 @@
@@ -154,7 +156,7 @@
public void func_219274_a(Chunk p_219274_1_) {
if (this.field_219321_p != 0 || this.field_219325_t != 0 || this.field_219324_s != 0) {
World world = p_219274_1_.func_177412_p();
- if (this.field_219321_p == 64) {
+ if (this.field_219321_p >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) {
this.field_219323_r = -1;
}
@@ -177,20 +179,19 @@
int k = (this.field_219320_o[0] >> 8 & 15) + this.field_219319_n.field_77275_b * 16;
BlockPos blockpos = new BlockPos(l, j1, k);
this.func_219293_a(new SChangeBlockPacket(world, blockpos), false);
@ -29,12 +38,9 @@
- } else if (this.field_219321_p == 64) {
+ } else if (this.field_219321_p >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) {
this.func_219293_a(new SChunkDataPacket(p_219274_1_, this.field_219322_q), false);
+ //TODO: Fix Mojang's fuckup to modded by combining all TE data into the chunk data packet... seriously... packet size explosion!
} else if (this.field_219321_p != 0) {
this.func_219293_a(new SMultiBlockChangePacket(this.field_219321_p, this.field_219320_o, p_219274_1_), false);
-
+ //} Keep this in the else until we figure out a fix for mojang's derpitude on the data packet so we don't double send crap.
+ //{// Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small
for(int i1 = 0; i1 < this.field_219321_p; ++i1) {
int k1 = (this.field_219320_o[i1] >> 12 & 15) + this.field_219319_n.field_77276_a * 16;
int l1 = this.field_219320_o[i1] & 255;

View File

@ -1,79 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.crafting;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
public class RecipeType<T extends IRecipe>
{
private static final Map<ResourceLocation, RecipeType<?>> TYPES = new HashMap<>();
protected final ResourceLocation id;
protected final Class<? extends T> baseClass;
private RecipeType(ResourceLocation id, Class<? extends T> baseClass) {
this.id = id;
this.baseClass = baseClass;
}
public ResourceLocation getId()
{
return id;
}
/**
* @return The class that all recipes of this type must extend.
*/
public Class<? extends T> getBaseClass()
{
return baseClass;
}
/**
* @param id The name of the recipe type.
* @param baseClass The base class of all recipes using this type.
* @return A recipe type, with the provided ID and base class, or null, if the entry exists and the base class is incorrect.
*/
@SuppressWarnings("unchecked")
@Nullable
public static <T extends IRecipe> RecipeType<T> get(ResourceLocation id, Class<? extends T> baseClass)
{
RecipeType<?> type = TYPES.get(id);
if(type == null)
{
type = new RecipeType<>(id, baseClass);
TYPES.put(id, type);
}
else if(type.getBaseClass() != baseClass)
{
LogManager.getLogger().error("Attempted to access RecipeType {} with the wrong base class. Provided {}, expected {}.");
return null;
}
return (RecipeType<T>) type;
}
}

View File

@ -1,38 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.crafting;
import net.minecraft.item.crafting.FurnaceRecipe;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
public final class VanillaRecipeTypes
{
/**
* Used for normal crafting.
*/
public static final RecipeType<IRecipe> CRAFTING = RecipeType.get(new ResourceLocation("crafting"), IRecipe.class);
/**
* Used for furnace recipes.
*/
public static final RecipeType<FurnaceRecipe> SMELTING = RecipeType.get(new ResourceLocation("smelting"), FurnaceRecipe.class);
}