mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
Fixed PlayerSleepInBedEvent pos is always null Closes #5936
Fixed decompile error causing Endless Loop in ModelBackery if model errors exist. Fixed NPEs related to teleporting players without portals.
This commit is contained in:
1 parent
3d78f30d18
commit
a46b7cb67a
4 files changed
+40
-19
No files matched your search
@@ -18,6 +18,15 @@
|
||||
return pair1;
|
||||
} catch (Exception exception1) {
|
||||
throw new ModelBakery.BlockStateDefinitionException(String.format("Exception loading blockstate definition: '%s' in resourcepack: '%s': %s", p_217839_1_.func_199029_a(), p_217839_1_.func_199026_d(), exception1.getMessage()));
|
||||
@@ -326,7 +326,7 @@
|
||||
|
||||
while(true) {
|
||||
if (!iterator.hasNext()) {
|
||||
- ;
|
||||
+ break; //Forge fix decompile error.
|
||||
} else {
|
||||
Entry<ModelResourceLocation, BlockState> entry = (Entry)iterator.next();
|
||||
IUnbakedModel iunbakedmodel1 = map1.get(entry.getValue());
|
||||
@@ -381,7 +381,12 @@
|
||||
|
||||
@Nullable
|
||||
@@ -25,7 +34,7 @@
|
||||
- Triple<ResourceLocation, ModelRotation, Boolean> triple = Triple.of(p_217845_1_, p_217845_2_.func_188048_b(), p_217845_2_.func_188049_c());
|
||||
+ return getBakedModel(p_217845_1_, p_217845_2_, this.field_177609_j::func_195424_a, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @Nullable
|
||||
+ public IBakedModel getBakedModel(ResourceLocation p_217845_1_, ISprite p_217845_2_, java.util.function.Function<ResourceLocation, net.minecraft.client.renderer.texture.TextureAtlasSprite> textureGetter, net.minecraft.client.renderer.vertex.VertexFormat format) {
|
||||
+ Triple<ResourceLocation, net.minecraftforge.common.model.IModelState, Boolean> triple = Triple.of(p_217845_1_, p_217845_2_.getState(), p_217845_2_.func_188049_c());
|
||||
|
||||
@@ -249,7 +249,20 @@
|
||||
this.field_70170_p.func_217381_Z().func_76319_b();
|
||||
serverworld.func_82742_i();
|
||||
serverworld1.func_82742_i();
|
||||
@@ -2274,7 +2297,7 @@
|
||||
@@ -2146,10 +2169,12 @@
|
||||
}
|
||||
|
||||
public Vec3d func_181014_aG() {
|
||||
+ if (this.field_181017_ao == null) return Vec3d.field_186680_a;
|
||||
return this.field_181017_ao;
|
||||
}
|
||||
|
||||
public Direction func_181012_aH() {
|
||||
+ if (this.field_181018_ap == null) return Direction.NORTH;
|
||||
return this.field_181018_ap;
|
||||
}
|
||||
|
||||
@@ -2274,7 +2299,7 @@
|
||||
Pose pose = this.func_213283_Z();
|
||||
EntitySize entitysize1 = this.func_213305_a(pose);
|
||||
this.field_213325_aI = entitysize1;
|
||||
@@ -258,7 +271,7 @@
|
||||
if (entitysize1.field_220315_a < entitysize.field_220315_a) {
|
||||
double d0 = (double)entitysize1.field_220315_a / 2.0D;
|
||||
this.func_174826_a(new AxisAlignedBB(this.field_70165_t - d0, this.field_70163_u, this.field_70161_v - d0, this.field_70165_t + d0, this.field_70163_u + (double)entitysize1.field_220316_b, this.field_70161_v + d0));
|
||||
@@ -2641,6 +2664,7 @@
|
||||
@@ -2641,6 +2666,7 @@
|
||||
return this.field_211517_W;
|
||||
}
|
||||
|
||||
@@ -266,7 +279,7 @@
|
||||
public final float func_213311_cf() {
|
||||
return this.field_213325_aI.field_220315_a;
|
||||
}
|
||||
@@ -2670,4 +2694,69 @@
|
||||
@@ -2670,4 +2696,69 @@
|
||||
public void func_213293_j(double p_213293_1_, double p_213293_3_, double p_213293_5_) {
|
||||
this.func_213317_d(new Vec3d(p_213293_1_, p_213293_3_, p_213293_5_));
|
||||
}
|
||||
|
||||
@@ -272,25 +272,26 @@
|
||||
this.func_184602_cy();
|
||||
this.field_70170_p.func_72960_a(this, (byte)30);
|
||||
}
|
||||
@@ -1132,6 +1195,8 @@
|
||||
@@ -1132,6 +1195,9 @@
|
||||
}
|
||||
|
||||
public Either<PlayerEntity.SleepResult, Unit> func_213819_a(BlockPos p_213819_1_) {
|
||||
+ PlayerEntity.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, func_213374_dv());
|
||||
+ Optional<BlockPos> optAt = Optional.of(p_213819_1_);
|
||||
+ PlayerEntity.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, optAt);
|
||||
+ if (ret != null) return Either.left(ret);
|
||||
Direction direction = this.field_70170_p.func_180495_p(p_213819_1_).func_177229_b(HorizontalBlock.field_185512_D);
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
if (this.func_70608_bn() || !this.func_70089_S()) {
|
||||
@@ -1142,7 +1207,7 @@
|
||||
@@ -1142,7 +1208,7 @@
|
||||
return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_HERE);
|
||||
}
|
||||
|
||||
- if (this.field_70170_p.func_72935_r()) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, func_213374_dv())) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, optAt)) {
|
||||
return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_NOW);
|
||||
}
|
||||
|
||||
@@ -1184,6 +1249,8 @@
|
||||
@@ -1184,6 +1250,8 @@
|
||||
private boolean func_190774_a(BlockPos p_190774_1_, Direction p_190774_2_) {
|
||||
if (Math.abs(this.field_70165_t - (double)p_190774_1_.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)p_190774_1_.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)p_190774_1_.func_177952_p()) <= 3.0D) {
|
||||
return true;
|
||||
@@ -299,7 +300,7 @@
|
||||
} else {
|
||||
BlockPos blockpos = p_190774_1_.func_177972_a(p_190774_2_.func_176734_d());
|
||||
return Math.abs(this.field_70165_t - (double)blockpos.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)blockpos.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)blockpos.func_177952_p()) <= 3.0D;
|
||||
@@ -1196,6 +1263,7 @@
|
||||
@@ -1196,6 +1264,7 @@
|
||||
}
|
||||
|
||||
public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) {
|
||||
@@ -307,7 +308,7 @@
|
||||
Optional<BlockPos> optional = this.func_213374_dv();
|
||||
super.func_213366_dy();
|
||||
if (this.field_70170_p instanceof ServerWorld && p_70999_2_) {
|
||||
@@ -1216,17 +1284,17 @@
|
||||
@@ -1216,17 +1285,17 @@
|
||||
}
|
||||
|
||||
public static Optional<Vec3d> func_213822_a(IWorldReader p_213822_0_, BlockPos p_213822_1_, boolean p_213822_2_) {
|
||||
@@ -329,7 +330,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1241,23 +1309,67 @@
|
||||
@@ -1241,23 +1310,67 @@
|
||||
public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) {
|
||||
}
|
||||
|
||||
@@ -406,7 +407,7 @@
|
||||
}
|
||||
|
||||
public void func_195066_a(ResourceLocation p_195066_1_) {
|
||||
@@ -1423,6 +1535,8 @@
|
||||
@@ -1423,6 +1536,8 @@
|
||||
}
|
||||
|
||||
super.func_180430_e(p_180430_1_, p_180430_2_);
|
||||
@@ -415,7 +416,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1685,7 +1799,10 @@
|
||||
@@ -1685,7 +1800,10 @@
|
||||
}
|
||||
|
||||
public ITextComponent func_145748_c_() {
|
||||
@@ -427,7 +428,7 @@
|
||||
return this.func_208016_c(itextcomponent);
|
||||
}
|
||||
|
||||
@@ -1921,4 +2038,44 @@
|
||||
@@ -1921,4 +2039,44 @@
|
||||
return this.field_221260_g;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import net.minecraft.command.arguments.EntityArgument;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||
@@ -36,7 +35,6 @@ import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class CommandSetDimension
|
||||
{
|
||||
@@ -65,8 +63,8 @@ public class CommandSetDimension
|
||||
//if (!DimensionManager.isDimensionRegistered(dim))
|
||||
// throw INVALID_DIMENSION.create(dim);
|
||||
|
||||
entities.stream().filter(e -> e.dimension == dim).forEach(e -> sender.sendFeedback(new TranslationTextComponent("commands.forge.setdim.invalid.nochange", e.getDisplayName(), dim), true));
|
||||
entities.stream().filter(e -> e.dimension != dim).forEach(e -> e.changeDimension(dim));
|
||||
entities.stream().filter(e -> e.dimension == dim).forEach(e -> sender.sendFeedback(new TranslationTextComponent("commands.forge.setdim.invalid.nochange", e.getDisplayName().getFormattedText(), dim), true));
|
||||
entities.stream().filter(e -> e.dimension != dim).forEach(e -> e.changeDimension(dim));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user