Fix checkPatches task. Closes #6956
Fix patched in method using srg name. Closes #6965 Fix capabilities not being collected for ClientWorld. Closes #6966 Fix TagEmptyCondition using client side copy of tags instead of server. Closes #6949 Fix ExtendedButton using narrator text. Closes #6958, Closes #6959 Fix misaligned patch in RepairContainer. Closes #6950, Closes #6953 Fix LivingJumpEvent not being fired for players jumping horses. Closes #6929 Remove extra getToughness method in ArmorItem. Closes #6970 Remove GetCollisionBoxesEvent. Closes #6921
This commit is contained in:
parent
065ebde57e
commit
201349f8de
12 changed files with 49 additions and 116 deletions
|
@ -6,6 +6,7 @@ import org.gradle.api.tasks.InputDirectory
|
|||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.regex.Pattern
|
||||
|
||||
public class CheckPatches extends DefaultTask {
|
||||
|
@ -15,14 +16,14 @@ public class CheckPatches extends DefaultTask {
|
|||
@TaskAction
|
||||
protected void exec() {
|
||||
def hasS2SArtifact = [
|
||||
"patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch",
|
||||
"patches/minecraft/net/minecraft/data/BlockModelDefinition.java.patch"
|
||||
Paths.get("patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch"),
|
||||
Paths.get("patches/minecraft/net/minecraft/data/BlockModelDefinition.java.patch")
|
||||
]
|
||||
|
||||
def verified = true;
|
||||
project.fileTree(patchDir).each { patch ->
|
||||
def patchPath = project.rootDir.toPath().relativize(patch.toPath()).toString()
|
||||
verified &= verifyPatch(patch, autoFix, patchPath, hasS2SArtifact.contains(patchPath))
|
||||
def patchPath = project.rootDir.toPath().relativize(patch.toPath())
|
||||
verified &= verifyPatch(patch, autoFix, patchPath.toString(), hasS2SArtifact.contains(patchPath))
|
||||
}
|
||||
|
||||
if (!verified)
|
||||
|
@ -61,19 +62,21 @@ public class CheckPatches extends DefaultTask {
|
|||
if (hunk_start_pattern.matcher(line).find()) {
|
||||
if (onlyWhiteSpace) {
|
||||
if (fix || hasS2SArtifact) {
|
||||
logger.lifecycle("Removing white space hunk starting at {}, file: {}", hunksStart + 1, patchPath)
|
||||
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
def toRemove = i - hunksStart;
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
didFix = true
|
||||
}
|
||||
else {
|
||||
logger.lifecycle("Patch contains only white space hunk starting at {}, file: {}", hunksStart + 1, patchPath)
|
||||
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
whiteSpaceErrors.each { logger.lifecycle(it) }
|
||||
if (!whiteSpaceErrors.empty)
|
||||
hasProblem = true
|
||||
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
|
||||
whiteSpaceErrors.clear()
|
||||
}
|
||||
hunksStart = i
|
||||
|
@ -101,7 +104,7 @@ public class CheckPatches extends DefaultTask {
|
|||
pMatcher.group(5) == cMatcher.group(5) && // field name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
logger.lifecycle("Patch contains access changes or final removal at {}, file: {}", i + 1, patchPath)
|
||||
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
|
||||
|
@ -113,7 +116,7 @@ public class CheckPatches extends DefaultTask {
|
|||
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
logger.lifecycle("Patch contains access changes or final removal at {}, file: {}", i + 1, patchPath)
|
||||
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
|
||||
|
@ -125,7 +128,7 @@ public class CheckPatches extends DefaultTask {
|
|||
pMatcher.group(5) == cMatcher.group(5) && // class | interface
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
logger.lifecycle("Patch contains access changes or final removal at {}, file: {}", i + 1, patchPath)
|
||||
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +155,7 @@ public class CheckPatches extends DefaultTask {
|
|||
def nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
|
||||
|
||||
if (!prevLineChange && !nextLineChange) {
|
||||
whiteSpaceErrors.add(String.format("Patch contains white space change in valid hunk at %d (cannot auto fix), file: %s", i + 1, patchPath))
|
||||
whiteSpaceErrors.add(String.format("Patch contains white space change in valid hunk at line %d (cannot auto fix), file: %s", i + 1, patchPath))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,18 +182,20 @@ public class CheckPatches extends DefaultTask {
|
|||
|
||||
if (onlyWhiteSpace) {
|
||||
if (fix || hasS2SArtifact) {
|
||||
logger.lifecycle("Removing white space hunk starting at {}, file: {}", hunksStart + 1, patchPath)
|
||||
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
def toRemove = i - hunksStart;
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
didFix = true
|
||||
}
|
||||
else {
|
||||
logger.lifecycle("Patch contains only white space hunk starting at {}, file: {}", hunksStart + 1, patchPath)
|
||||
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
|
||||
hasProblem = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!whiteSpaceErrors.empty)
|
||||
hasProblem = true
|
||||
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
- this.func_238654_b_(p_230457_1_, this.func_231151_a_(p_230457_2_), p_230457_3_, p_230457_4_);
|
||||
+ FontRenderer font = p_230457_2_.func_77973_b().getFontRenderer(p_230457_2_);
|
||||
+ net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_230457_2_);
|
||||
+ this.func_238654_b_(p_230457_1_, this.func_231151_a_(p_230457_2_), p_230457_3_, p_230457_4_, (font == null ? this.field_230712_o_ : font));
|
||||
+ this.renderToolTip(p_230457_1_, this.func_231151_a_(p_230457_2_), p_230457_3_, p_230457_4_, (font == null ? this.field_230712_o_ : font));
|
||||
+ net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip();
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
|||
|
||||
public void func_238654_b_(MatrixStack p_238654_1_, List<? extends ITextProperties> p_238654_2_, int p_238654_3_, int p_238654_4_) {
|
||||
- if (!p_238654_2_.isEmpty()) {
|
||||
+ this.func_238654_b_(p_238654_1_, p_238654_2_, p_238654_3_, p_238654_4_, field_230712_o_);
|
||||
+ this.renderToolTip(p_238654_1_, p_238654_2_, p_238654_3_, p_238654_4_, field_230712_o_);
|
||||
+ }
|
||||
+ public void func_238654_b_(MatrixStack p_238654_1_, List<? extends ITextProperties> p_238654_2_, int p_238654_3_, int p_238654_4_, FontRenderer font) {
|
||||
+ public void renderToolTip(MatrixStack p_238654_1_, List<? extends ITextProperties> p_238654_2_, int p_238654_3_, int p_238654_4_, FontRenderer font) {
|
||||
+ net.minecraftforge.fml.client.gui.GuiUtils.drawHoveringText(p_238654_1_, p_238654_2_, p_238654_3_, p_238654_4_, field_230708_k_, field_230709_l_, -1, font);
|
||||
+ if (false && !p_238654_2_.isEmpty()) {
|
||||
int i = 0;
|
||||
|
|
|
@ -181,7 +181,7 @@
|
|||
- this.func_238654_b_(p_230457_1_, list1, p_230457_3_, p_230457_4_);
|
||||
+ net.minecraft.client.gui.FontRenderer font = p_230457_2_.func_77973_b().getFontRenderer(p_230457_2_);
|
||||
+ net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_230457_2_);
|
||||
+ this.func_238654_b_(p_230457_1_, list1, p_230457_3_, p_230457_4_, (font == null ? this.field_230712_o_ : font));
|
||||
+ this.renderToolTip(p_230457_1_, list1, p_230457_3_, p_230457_4_, (font == null ? this.field_230712_o_ : font));
|
||||
+ net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip();
|
||||
} else {
|
||||
super.func_230457_a_(p_230457_1_, p_230457_2_, p_230457_3_, p_230457_4_);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
this.func_239136_a_(new BlockPos(8, 64, 8));
|
||||
this.func_72966_v();
|
||||
this.func_72947_a();
|
||||
+ //this.gatherCapabilities(dimension.initCapabilities()); //TODO
|
||||
+ this.gatherCapabilities();
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,15 @@
|
|||
}
|
||||
|
||||
if (this.func_184207_aI() && this.field_190688_bE) {
|
||||
@@ -1010,4 +1011,22 @@
|
||||
@@ -693,6 +694,7 @@
|
||||
this.func_213293_j(vector3d.field_72450_a, d1, vector3d.field_72449_c);
|
||||
this.func_110255_k(true);
|
||||
this.field_70160_al = true;
|
||||
+ net.minecraftforge.common.ForgeHooks.onLivingJump(this);
|
||||
if (f1 > 0.0F) {
|
||||
float f2 = MathHelper.func_76126_a(this.field_70177_z * ((float)Math.PI / 180F));
|
||||
float f3 = MathHelper.func_76134_b(this.field_70177_z * ((float)Math.PI / 180F));
|
||||
@@ -1010,4 +1012,22 @@
|
||||
this.func_230273_eI_();
|
||||
return super.func_213386_a(p_213386_1_, p_213386_2_, p_213386_3_, p_213386_4_, p_213386_5_);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
--- a/net/minecraft/inventory/container/RepairContainer.java
|
||||
+++ b/net/minecraft/inventory/container/RepairContainer.java
|
||||
@@ -63,6 +63,8 @@
|
||||
@@ -48,6 +48,8 @@
|
||||
p_230301_1_.func_82242_a(-this.field_82854_e.func_221495_b());
|
||||
}
|
||||
|
||||
+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_230301_1_, p_230301_2_, RepairContainer.this.field_234643_d_.func_70301_a(0), RepairContainer.this.field_234643_d_.func_70301_a(1));
|
||||
+
|
||||
this.field_234643_d_.func_70299_a(0, ItemStack.field_190927_a);
|
||||
if (this.field_82856_l > 0) {
|
||||
ItemStack itemstack = this.field_234643_d_.func_70301_a(1);
|
||||
@@ -64,7 +66,7 @@
|
||||
this.field_82854_e.func_221494_a(0);
|
||||
this.field_234644_e_.func_221486_a((p_234633_1_, p_234633_2_) -> {
|
||||
+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_230301_1_, p_230301_2_, RepairContainer.this.field_234643_d_.func_70301_a(0), RepairContainer.this.field_234643_d_.func_70301_a(1));
|
||||
+
|
||||
BlockState blockstate = p_234633_1_.func_180495_p(p_234633_2_);
|
||||
if (!p_230301_1_.field_71075_bZ.field_75098_d && blockstate.func_235714_a_(BlockTags.field_200572_k) && p_230301_1_.func_70681_au().nextFloat() < 0.12F) {
|
||||
- if (!p_230301_1_.field_71075_bZ.field_75098_d && blockstate.func_235714_a_(BlockTags.field_200572_k) && p_230301_1_.func_70681_au().nextFloat() < 0.12F) {
|
||||
+ if (!p_230301_1_.field_71075_bZ.field_75098_d && blockstate.func_235714_a_(BlockTags.field_200572_k) && p_230301_1_.func_70681_au().nextFloat() < breakChance) {
|
||||
BlockState blockstate1 = AnvilBlock.func_196433_f(blockstate);
|
||||
if (blockstate1 == null) {
|
||||
p_234633_1_.func_217377_a(p_234633_2_, false);
|
||||
@@ -96,8 +98,11 @@
|
||||
Map<Enchantment, Integer> map = EnchantmentHelper.func_82781_a(itemstack1);
|
||||
j = j + itemstack.func_82838_A() + (itemstack2.func_190926_b() ? 0 : itemstack2.func_82838_A());
|
||||
|
|
|
@ -9,14 +9,3 @@
|
|||
builder.put(Attributes.field_233820_c_, new AttributeModifier(uuid, "Armor knockback resistance", (double)this.field_234655_c_, AttributeModifier.Operation.ADDITION));
|
||||
}
|
||||
|
||||
@@ -113,6 +113,10 @@
|
||||
return this.field_77879_b;
|
||||
}
|
||||
|
||||
+ public float getToughness() {
|
||||
+ return this.field_189415_e;
|
||||
+ }
|
||||
+
|
||||
public float func_234657_f_() {
|
||||
return this.field_189415_e;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagCollectionManager;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
|
@ -57,7 +58,7 @@ public class TagEmptyCondition implements ICondition
|
|||
@Override
|
||||
public boolean test()
|
||||
{
|
||||
ITag<Item> tag = ItemTags.getCollection().get(tag_name);
|
||||
ITag<Item> tag = TagCollectionManager.func_232928_e_().func_232925_b_().get(tag_name);
|
||||
return tag == null || tag.func_230236_b_().isEmpty();
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,6 @@ import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
|
|||
import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent;
|
||||
import net.minecraftforge.event.world.ChunkWatchEvent;
|
||||
import net.minecraftforge.event.world.ExplosionEvent;
|
||||
import net.minecraftforge.event.world.GetCollisionBoxesEvent;
|
||||
import net.minecraftforge.event.world.PistonEvent;
|
||||
import net.minecraftforge.event.world.SaplingGrowTreeEvent;
|
||||
import net.minecraftforge.event.world.SleepFinishedTimeEvent;
|
||||
|
@ -672,12 +671,6 @@ public class ForgeEventFactory
|
|||
return !MinecraftForge.EVENT_BUS.post(new LivingDestroyBlockEvent(entity, pos, state));
|
||||
}
|
||||
|
||||
public static boolean gatherCollisionBoxes(World world, Entity entity, AxisAlignedBB aabb, List<AxisAlignedBB> outList)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new GetCollisionBoxesEvent(world, entity, aabb, outList));
|
||||
return outList.isEmpty();
|
||||
}
|
||||
|
||||
public static boolean getMobGriefingEvent(World world, Entity entity)
|
||||
{
|
||||
EntityMobGriefingEvent event = new EntityMobGriefingEvent(entity);
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* 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.event.world;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This event is fired during {@link World#collidesWithAnyBlock(AxisAlignedBB)}
|
||||
* and before returning the list in {@link World#getCollisionBoxes(Entity, AxisAlignedBB)}<br>
|
||||
* <br>
|
||||
* {@link #entity} contains the entity passed in the {@link World#getCollisionBoxes(Entity, AxisAlignedBB)}. <b>Can be null.</b> Calls from {@link World#collidesWithAnyBlock(AxisAlignedBB)} will be null.<br>
|
||||
* {@link #aabb} contains the AxisAlignedBB passed in the method.<br>
|
||||
* {@link #collisionBoxesList} contains the list of detected collision boxes intersecting with {@link #aabb}. The list can be modified.<br>
|
||||
* <br>
|
||||
* This event is not {@link Cancelable}.<br>
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult} <br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
public class GetCollisionBoxesEvent extends WorldEvent
|
||||
{
|
||||
private final Entity entity;
|
||||
private final AxisAlignedBB aabb;
|
||||
private final List<AxisAlignedBB> collisionBoxesList;
|
||||
|
||||
public GetCollisionBoxesEvent(World world, @Nullable Entity entity, AxisAlignedBB aabb, List<AxisAlignedBB> collisionBoxesList)
|
||||
{
|
||||
super(world);
|
||||
this.entity = entity;
|
||||
this.aabb = aabb;
|
||||
this.collisionBoxesList = collisionBoxesList;
|
||||
}
|
||||
|
||||
public Entity getEntity()
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getAabb()
|
||||
{
|
||||
return aabb;
|
||||
}
|
||||
|
||||
public List<AxisAlignedBB> getCollisionBoxesList()
|
||||
{
|
||||
return collisionBoxesList;
|
||||
}
|
||||
}
|
|
@ -58,7 +58,7 @@ public class ExtendedButton extends Button
|
|||
GuiUtils.drawContinuousTexturedBox(field_230687_i_, this.field_230690_l_, this.field_230691_m_, 0, 46 + k * 20, this.field_230688_j_, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
|
||||
this.func_230441_a_(mStack, mc, mouseX, mouseY);
|
||||
|
||||
ITextComponent buttonText = this.func_230442_c_();
|
||||
ITextComponent buttonText = this.func_230458_i_();
|
||||
int strWidth = mc.fontRenderer.func_238414_a_(buttonText);
|
||||
int ellipsisWidth = mc.fontRenderer.getStringWidth("...");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ net/minecraft/block/FlowerPotBlock.<init>(Ljava/util/function/Supplier;Ljava/uti
|
|||
net/minecraft/block/PoweredRailBlock.<init>(Lnet/minecraft/block/Block$Properties;Z)=|p_i48349_1_,isActivator
|
||||
net/minecraft/block/RedstoneWireBlock.canConnectTo(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/IBlockReader;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/Direction;)Z=|p_176343_0_,world,pos,p_176343_1_
|
||||
|
||||
net/minecraft/client/gui/screen/Screen.renderToolTip(Lcom/mojang/blaze3d/matrix/MatrixStack;Ljava/util/List;IILnet/minecraft/client/gui/FontRenderer;)V=|p_238654_1_,p_238654_2_,p_238654_3_,p_238654_4_,font
|
||||
net/minecraft/client/gui/ScreenManager.getScreenFactory(Lnet/minecraft/inventory/container/ContainerType;Lnet/minecraft/client/Minecraft;ILnet/minecraft/util/text/ITextComponent;)Ljava/util/Optional;=|p_216909_0_,p_216909_1_,p_216909_2_,p_216909_3_
|
||||
|
||||
net/minecraft/client/renderer/BlockModelRenderer.renderModel(Lnet/minecraft/world/ILightReader;Lnet/minecraft/client/renderer/model/IBakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lcom/mojang/blaze3d/matrix/MatrixStack;Lcom/mojang/blaze3d/vertex/IVertexBuilder;ZLjava/util/Random;JILnet/minecraftforge/client/model/data/IModelData;)Z=|p_228802_1_,p_228802_2_,p_228802_3_,p_228802_4_,p_228802_5_,p_228802_6_,p_228802_7_,p_228802_8_,p_228802_9_,p_228802_11_,modelData
|
||||
|
|
Loading…
Reference in a new issue