Merge remote-tracking branch 'upstream/mc1.15/dev' into mc1.15/dev

This commit is contained in:
JozsefA 2021-03-08 14:04:25 -08:00
commit 2b37842259
5 changed files with 29 additions and 14 deletions

View file

@ -21,6 +21,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -38,6 +39,9 @@ import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.common.util.Constants.BlockFlags;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.PacketDistributor;
@ -227,7 +231,15 @@ public class SymmetryWandItem extends Item {
if (BlockHelper.findAndRemoveInInventory(blockState, player, 1) == 0)
continue;
BlockSnapshot blocksnapshot = BlockSnapshot.getBlockSnapshot(world, position);
IFluidState ifluidstate = world.getFluidState(position);
world.setBlockState(position, ifluidstate.getBlockState(), BlockFlags.UPDATE_NEIGHBORS);
world.setBlockState(position, blockState);
if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP)) {
blocksnapshot.restore(true, false);
continue;
}
targets.add(position);
}
}

View file

@ -98,12 +98,13 @@ public class PonderTooltipHandler {
float renderPartialTicks = AnimationTickHolder.getPartialTicks();
if (lastHoveredStack != stack)
return;
if (subject) {
toolTip.set(1, Lang.createTranslationTextComponent(SUBJECT)
.applyTextStyle(TextFormatting.GREEN));
return;
}
toolTip.set(1, makeProgressBar(Math.min(1, holdWProgress.getValue(renderPartialTicks) * 8 / 7f)));
ITextComponent component = subject ? Lang.createTranslationTextComponent(SUBJECT)
.applyTextStyle(TextFormatting.GREEN)
: makeProgressBar(Math.min(1, holdWProgress.getValue(renderPartialTicks) * 8 / 7f));
if (toolTip.size() < 2)
toolTip.add(component);
else
toolTip.set(1, component);
}
public static void handleTooltipColor(RenderTooltipEvent.Color event) {

View file

@ -42,6 +42,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.LightType;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.registries.ForgeRegistries;
public class PonderWorld extends SchematicWorld {
@ -49,7 +50,9 @@ public class PonderWorld extends SchematicWorld {
protected Map<BlockPos, BlockState> originalBlocks;
protected Map<BlockPos, TileEntity> originalTileEntities;
protected List<Entity> originalEntities;
protected PonderWorldParticles particles;
private final Map<ResourceLocation, IParticleFactory<?>> particleFactories;
int overrideLight;
Selection mask;
@ -60,6 +63,10 @@ public class PonderWorld extends SchematicWorld {
originalTileEntities = new HashMap<>();
originalEntities = new ArrayList<>();
particles = new PonderWorldParticles(this);
// ParticleManager.factories - ATs don't seem to like this one
particleFactories = ObfuscationReflectionHelper.getPrivateValue(ParticleManager.class,
Minecraft.getInstance().particles, "field_178932_g");
}
public void createBackup() {
@ -186,9 +193,8 @@ public class PonderWorld extends SchematicWorld {
@SuppressWarnings("unchecked")
private <T extends IParticleData> Particle makeParticle(T data, double x, double y, double z, double mx, double my,
double mz) {
ParticleManager particleManager = Minecraft.getInstance().particles;
ResourceLocation key = ForgeRegistries.PARTICLE_TYPES.getKey(data.getType());
IParticleFactory<T> iparticlefactory = (IParticleFactory<T>) particleManager.factories.get(key);
IParticleFactory<T> iparticlefactory = (IParticleFactory<T>) particleFactories.get(key);
return iparticlefactory == null ? null : iparticlefactory.makeParticle(data, this, x, y, z, mx, my, mz);
}

View file

@ -25,14 +25,13 @@ public class Lang {
public static List<String> translatedOptions(String prefix, String... keys) {
List<String> result = new ArrayList<>(keys.length);
for (String key : keys) {
for (String key : keys)
result.add(translate(prefix + "." + key));
}
return result;
}
public static String asId(String name) {
return name.toLowerCase(Locale.ENGLISH);
return name.toLowerCase(Locale.ROOT);
}
}

View file

@ -25,9 +25,6 @@ public net.minecraft.tileentity.BeaconTileEntity field_174909_f # beamSegments
public net.minecraft.world.server.ServerTickList field_205374_d # pendingTickListEntriesHashSet
public net.minecraft.world.server.ServerTickList field_205375_e # pendingTickListEntriesTreeSet
# Particle Manager
public net.minecraft.client.particle.ParticleManager field_178932_g # factories
# Lightmap information for instanced rendering
public net.minecraft.client.renderer.LightTexture field_205112_c #resourceLocation
public net.minecraft.client.Minecraft field_193996_ah #renderPartialTicksPaused