~williewillus/botania

af6cc2db21fb732049560fb304e8056058cbe8e4 — quaternary 1 year, 5 months ago e7864c9 release-1.16.5-420.3
[1.16] Assorted low-hanging-fruit backports (#4061)

* Backport jappa style cacophonium block
(a90fdba64d505ba489aa7922585a72756a5c53d1)

* move to the non-datagenned resources cause i can't get datagen running on this workspace to backport it propertly, ugh

* backport f1 hiding tater names, 3835af698ded009fe35368441a9622dad1d72ae0

* backport breaking vines with Canopy horn, 4d91a5add83f09796a3dfda83c7acbebc3596b4b

* Backport and uh, fix, phantom ink on luminizers 2e013544522612bce539f4907669b4d62796d6aa

* Don't modify IHornHarvestable API class
8 files changed, 66 insertions(+), 12 deletions(-)

M src/main/java/vazkii/botania/client/render/tile/RenderTileTinyPotato.java
M src/main/java/vazkii/botania/common/block/BlockLightRelay.java
M src/main/java/vazkii/botania/common/block/ModBlocks.java
M src/main/java/vazkii/botania/common/block/tile/TileLightRelay.java
M src/main/java/vazkii/botania/data/BlockstateProvider.java
R src/{generated/resources/assets/botania/models/block/cacophonium_block.json => main/resources/assets/botania/models/block/cacophonium_block.json}
D src/main/resources/assets/botania/textures/block/cacophonium_block.png
M src/main/resources/assets/botania/textures/block/cacophonium_block_top.png
M src/main/java/vazkii/botania/client/render/tile/RenderTileTinyPotato.java => src/main/java/vazkii/botania/client/render/tile/RenderTileTinyPotato.java +1 -1
@@ 191,7 191,7 @@ public class RenderTileTinyPotato extends TileEntityRenderer<TileTinyPotato> {
	private void renderName(TileTinyPotato potato, String name, MatrixStack ms, IRenderTypeBuffer buffers, int light) {
		Minecraft mc = Minecraft.getInstance();
		RayTraceResult pos = mc.objectMouseOver;
		if (!name.isEmpty() && pos != null && pos.getType() == RayTraceResult.Type.BLOCK
		if (Minecraft.isGuiEnabled() && !name.isEmpty() && pos != null && pos.getType() == RayTraceResult.Type.BLOCK
				&& potato.getPos().equals(((BlockRayTraceResult) pos).getPos())) {
			ms.push();
			ms.translate(0F, -0.6F, 0F);

M src/main/java/vazkii/botania/common/block/BlockLightRelay.java => src/main/java/vazkii/botania/common/block/BlockLightRelay.java +18 -4
@@ 29,9 29,11 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;

import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.state.enums.LuminizerVariant;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.tile.TileLightRelay;
import vazkii.botania.common.item.ModItems;

import javax.annotation.Nonnull;



@@ 62,13 64,25 @@ public class BlockLightRelay extends BlockModWaterloggable implements ITileEntit

	@Override
	public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
		if (player.getHeldItem(hand).getItem() != Items.ENDER_PEARL) {
			TileEntity te = world.getTileEntity(pos);
			if (te instanceof TileLightRelay) {
				((TileLightRelay) te).mountEntity(player);
		ItemStack held = player.getHeldItem(hand);
		TileEntity te = world.getTileEntity(pos);
		if (te instanceof TileLightRelay) {
			TileLightRelay relay = (TileLightRelay) te;
			if (held.getItem() == ModItems.phantomInk && !relay.isNoParticle()) {
				if (!world.isRemote) {
					relay.setNoParticle();
					if (!player.isCreative()) {
						held.shrink(1);
					}
					VanillaPacketDispatcher.dispatchTEToNearbyPlayers(relay);
				}
				return ActionResultType.SUCCESS;
			} else if (!(held.getItem() == Items.ENDER_PEARL)) {
				relay.mountEntity(player);
				return ActionResultType.SUCCESS;
			}
		}

		return ActionResultType.PASS;
	}


M src/main/java/vazkii/botania/common/block/ModBlocks.java => src/main/java/vazkii/botania/common/block/ModBlocks.java +27 -0
@@ 36,6 36,7 @@ import net.minecraft.item.Rarity;
import net.minecraft.item.WallOrFloorItem;
import net.minecraft.potion.Effects;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;


@@ 44,6 45,7 @@ import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;

import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IHornHarvestable;
import vazkii.botania.api.item.IPetalApothecary;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.AlfPortalState;


@@ 660,6 662,31 @@ public final class ModBlocks {
		BotaniaAPI.instance().registerHornHarvestableBlock(greenMushroom.getRegistryName(), DefaultHornHarvestable.INSTANCE);
		BotaniaAPI.instance().registerHornHarvestableBlock(redMushroom.getRegistryName(), DefaultHornHarvestable.INSTANCE);
		BotaniaAPI.instance().registerHornHarvestableBlock(blackShinyFlower.getRegistryName(), DefaultHornHarvestable.INSTANCE);

		//1.18 backport (less the CAVE_VINES, since those don't exist yet)
		//This is much less messy in 1.18 due to most of these methods having default impls
		//In the interest of not changing the API classes (in case someone is repackaging them), have this mess:
		IHornHarvestable isCanopy = new IHornHarvestable() {
			@Override
			public boolean canHornHarvest(World world, BlockPos pos, ItemStack stack, EnumHornType hornType) {
				return hornType == IHornHarvestable.EnumHornType.CANOPY;
			}

			@Override
			public boolean hasSpecialHornHarvest(World world, BlockPos pos, ItemStack stack, EnumHornType hornType) {
				return false;
			}

			@Override
			public void harvestByHorn(World world, BlockPos pos, ItemStack stack, EnumHornType hornType) {

			}
		};
		BotaniaAPI.instance().registerHornHarvestableBlock(Blocks.VINE.getRegistryName(), isCanopy);
		BotaniaAPI.instance().registerHornHarvestableBlock(Blocks.TWISTING_VINES.getRegistryName(), isCanopy);
		BotaniaAPI.instance().registerHornHarvestableBlock(Blocks.TWISTING_VINES_PLANT.getRegistryName(), isCanopy);
		BotaniaAPI.instance().registerHornHarvestableBlock(Blocks.WEEPING_VINES.getRegistryName(), isCanopy);
		BotaniaAPI.instance().registerHornHarvestableBlock(Blocks.WEEPING_VINES_PLANT.getRegistryName(), isCanopy);
	}

	public static void registerItemBlocks(RegistryEvent.Register<Item> evt) {

M src/main/java/vazkii/botania/common/block/tile/TileLightRelay.java => src/main/java/vazkii/botania/common/block/tile/TileLightRelay.java +13 -1
@@ 61,9 61,11 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
	private static final String TAG_BIND_X = "bindX";
	private static final String TAG_BIND_Y = "bindY";
	private static final String TAG_BIND_Z = "bindZ";
	private static final String TAG_NO_PARTICLE = "noParticle";

	private BlockPos bindPos = new BlockPos(0, -1, 0);
	private int ticksElapsed = 0;
	private boolean noParticle = false;

	public TileLightRelay() {
		super(ModTiles.LIGHT_RELAY);


@@ 92,7 94,7 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan

		BlockPos nextDest = getNextDestination();
		if (nextDest != null && nextDest.getY() > -1 && isValidBinding()) {
			if (world.isRemote) {
			if (world.isRemote && !isNoParticle()) {
				Vector3 vec = getMovementVector();
				if (vec != null) {
					double dist = 0.1;


@@ 176,6 178,14 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
		return null;
	}

	public void setNoParticle() {
		noParticle = true;
	}

	public boolean isNoParticle() {
		return noParticle;
	}

	public Vector3 getMovementVector() {
		BlockPos dest = getNextDestination();
		if (dest == null) {


@@ 246,6 256,7 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
				cmp.getInt(TAG_BIND_Y),
				cmp.getInt(TAG_BIND_Z)
		);
		noParticle = cmp.getBoolean(TAG_NO_PARTICLE);
	}

	@Override


@@ 253,6 264,7 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
		cmp.putInt(TAG_BIND_X, bindPos.getX());
		cmp.putInt(TAG_BIND_Y, bindPos.getY());
		cmp.putInt(TAG_BIND_Z, bindPos.getZ());
		cmp.putBoolean(TAG_NO_PARTICLE, noParticle);
	}

	public static class EntityPlayerMover extends Entity {

M src/main/java/vazkii/botania/data/BlockstateProvider.java => src/main/java/vazkii/botania/data/BlockstateProvider.java +5 -4
@@ 95,10 95,11 @@ public class BlockstateProvider extends BlockStateProvider {
		simpleBlock(bifrostPerm, models().cubeAll(bifrostPermName, prefix("block/bifrost")));
		remainingBlocks.remove(bifrostPerm);

		String cacophoniumName = Registry.BLOCK.getKey(cacophonium).getPath();
		simpleBlock(cacophonium, models().cubeTop(cacophoniumName,
				prefix("block/" + cacophoniumName),
				prefix("block/" + cacophoniumName + "_top")));
		/* manual (cherry-picked from 1.17 where datagen is much different)
		singleVariantBlockState(cacophonium,
				ModelTemplates.CUBE_TOP.create(cacophonium, (new TextureMapping())
						.put(TextureSlot.SIDE, getBlockTexture(Blocks.NOTE_BLOCK))
						.put(TextureSlot.TOP, getBlockTexture(cacophonium, "_top")), this.modelOutput)); */
		remainingBlocks.remove(cacophonium);

		String craftCrateName = Registry.BLOCK.getKey(craftCrate).getPath();

R src/generated/resources/assets/botania/models/block/cacophonium_block.json => src/main/resources/assets/botania/models/block/cacophonium_block.json +2 -2
@@ 1,7 1,7 @@
{
  "parent": "minecraft:block/cube_top",
  "textures": {
    "side": "botania:block/cacophonium_block",
    "top": "botania:block/cacophonium_block_top"
    "top": "botania:block/cacophonium_block_top",
    "side": "minecraft:block/note_block"
  }
}
\ No newline at end of file

D src/main/resources/assets/botania/textures/block/cacophonium_block.png => src/main/resources/assets/botania/textures/block/cacophonium_block.png +0 -0
M src/main/resources/assets/botania/textures/block/cacophonium_block_top.png => src/main/resources/assets/botania/textures/block/cacophonium_block_top.png +0 -0