From 497b742b87aa232e72babcb0500f5692ca4384fb Mon Sep 17 00:00:00 2001 From: Michael Hillcox Date: Sun, 20 Sep 2020 11:26:01 +0100 Subject: [PATCH] Ported most of SmilyCloud --- .../misc/cloud/SmileyCloudEasterEggs.java | 77 +++++----- .../common/ore/InitOreDict.java | 141 +++++++++--------- .../common/particle/ParticleLaserItem.java | 37 +++-- 3 files changed, 133 insertions(+), 122 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/common/misc/cloud/SmileyCloudEasterEggs.java b/src/main/java/de/ellpeck/actuallyadditions/common/misc/cloud/SmileyCloudEasterEggs.java index 0c0067364..dfe094957 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/common/misc/cloud/SmileyCloudEasterEggs.java +++ b/src/main/java/de/ellpeck/actuallyadditions/common/misc/cloud/SmileyCloudEasterEggs.java @@ -3,16 +3,16 @@ package de.ellpeck.actuallyadditions.common.misc.cloud; import java.util.ArrayList; import java.util.List; +import com.mojang.blaze3d.platform.GlStateManager; import de.ellpeck.actuallyadditions.common.blocks.InitBlocks; import de.ellpeck.actuallyadditions.common.items.InitItems; import de.ellpeck.actuallyadditions.common.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.common.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.common.util.AssetUtil; import net.minecraft.block.Block; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; public final class SmileyCloudEasterEggs { @@ -28,8 +28,8 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHoldingItem(true, new ItemStack(Items.DYE, 1, 2)); - renderHeadBlock(InitBlocks.blockHeatCollector, 0, 5F); + renderHoldingItem(true, new ItemStack(Items.GREEN_DYE, 1)); + renderHeadBlock(InitBlocks.blockHeatCollector.get(), 0, 5F); } }); //Ellpeck @@ -42,7 +42,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(InitItems.itemPhantomConnector)); - renderHeadBlock(InitBlocks.blockPhantomLiquiface, 0, 25F); + renderHeadBlock(InitBlocks.blockPhantomLiquiface.get(), 0, 25F); } }); //Tyrex @@ -55,7 +55,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(Items.FISHING_ROD)); - renderHoldingItem(true, new ItemStack(Items.FISH)); + renderHoldingItem(true, new ItemStack(Items.TROPICAL_FISH)); } }); //Hose @@ -67,7 +67,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHoldingItem(false, new ItemStack(Items.REEDS)); + renderHoldingItem(false, new ItemStack(Items.KELP)); renderHeadBlock(Blocks.TORCH, 0, 15F); } }); @@ -93,8 +93,8 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHoldingItem(true, new ItemStack(Items.DYE, 1, 15)); - renderHeadBlock(Blocks.RED_FLOWER, 5, 20F); + renderHoldingItem(true, new ItemStack(Items.BONE_MEAL, 1)); + renderHeadBlock(Blocks.POPPY, 0, 20F); } }); //Kitty @@ -106,9 +106,9 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHoldingItem(true, new ItemStack(Items.FISH)); + renderHoldingItem(true, new ItemStack(Items.TROPICAL_FISH)); renderHoldingItem(false, new ItemStack(Items.MILK_BUCKET)); - renderHeadBlock(Blocks.WOOL, 10, 15F); + renderHeadBlock(Blocks.PURPLE_WOOL, 0, 15F); } }); //Canitzp @@ -134,7 +134,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(Items.IRON_HELMET)); - renderHeadBlock(InitBlocks.blockBlackLotus, 0, 28F); + renderHeadBlock(InitBlocks.blockBlackLotus.get(), 0, 28F); } }); //RotesDing @@ -147,8 +147,8 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(Items.MILK_BUCKET)); - renderHoldingItem(true, new ItemStack(Items.DYE, 1, 1)); - renderHeadBlock(Blocks.WOOL, 14, 18F); + renderHoldingItem(true, new ItemStack(Items.RED_DYE, 1)); + renderHeadBlock(Blocks.RED_WOOL, 0, 18F); } }); //Bande @@ -161,7 +161,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(Items.DIAMOND_PICKAXE)); - renderHeadBlock(Blocks.WOOL, 4, 18F); + renderHeadBlock(Blocks.YELLOW_WOOL, 0, 18F); } }); //Wolle @@ -174,7 +174,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(Items.STRING)); - renderHeadBlock(Blocks.WOOL, 0, 18F); + renderHeadBlock(Blocks.WHITE_WOOL, 0, 18F); } }); //Pakto @@ -186,8 +186,8 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHoldingItem(false, new ItemStack(Items.DYE, 1, 9)); - renderHeadBlock(InitBlocks.blockColoredLampOn, 6, 18F); + renderHoldingItem(false, new ItemStack(Items.PINK_DYE, 1)); + renderHeadBlock(InitBlocks.blockColoredLampOn.get(), 6, 18F); } }); //Honka @@ -199,7 +199,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHoldingItem(false, new ItemStack(InitItems.itemLeafBlowerAdvanced, 1, 9)); + renderHoldingItem(false, new ItemStack(InitItems.itemLeafBlowerAdvanced, 1)); renderHeadBlock(Blocks.HAY_BLOCK, 0, 74F); } }); @@ -212,7 +212,8 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHoldingItem(false, new ItemStack(InitItems.itemFoods, 1, TheFoods.PIZZA.ordinal())); + // todo: replace with proper item name + renderHoldingItem(false, new ItemStack(InitItems.itemFoods, 1)); renderHeadBlock(Blocks.BOOKSHELF, 0, 27F); } }); @@ -226,7 +227,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(Items.WRITTEN_BOOK)); - renderHeadBlock(Blocks.WEB, 0, 56F); + renderHeadBlock(Blocks.COBWEB, 0, 56F); } }); //ShadowNinjaCat @@ -305,7 +306,8 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHoldingItem(false, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DRILL_CORE.ordinal())); + // todo: replace this with the right thing + renderHoldingItem(false, new ItemStack(InitItems.itemMisc, 1));// TheMiscItems.DRILL_CORE.ordinal())); renderHeadBlock(Blocks.REDSTONE_ORE, 0, 80F); } }); @@ -319,7 +321,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(Items.ENCHANTED_BOOK)); - renderHeadBlock(InitBlocks.blockDirectionalBreaker, 0, 40F); + renderHeadBlock(InitBlocks.blockDirectionalBreaker.get(), 0, 40F); } }); //Little Lampi (I still can't get over it) @@ -332,7 +334,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(Items.GLOWSTONE_DUST)); - renderHeadBlock(InitBlocks.blockColoredLampOn, 4, 40F); + renderHeadBlock(InitBlocks.blockColoredLampOn.get(), 4, 40F);// todo: fix meta } }); //AtomSponge @@ -358,7 +360,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(InitItems.itemSwordEmerald)); - renderHeadBlock(InitBlocks.blockCoffeeMachine, 0, 35F); + renderHeadBlock(InitBlocks.blockCoffeeMachine.get(), 0, 35F); } }); //Etho @@ -396,7 +398,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHeadBlock(InitBlocks.blockLaserRelayItem, 0, 27F); + renderHeadBlock(InitBlocks.blockLaserRelayItem.get(), 0, 27F); renderHoldingItem(false, new ItemStack(InitItems.itemLaserWrench)); } }); @@ -448,7 +450,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { renderHoldingItem(false, new ItemStack(InitItems.itemBooklet)); - renderHeadBlock(InitBlocks.blockSmileyCloud, 0, 13F); + renderHeadBlock(InitBlocks.blockSmileyCloud.get(), 0, 13F); } }); //MattaBase @@ -460,7 +462,7 @@ public final class SmileyCloudEasterEggs { @Override public void renderExtra(float f) { - renderHeadBlock(Blocks.WOOL, 13, 35F); + renderHeadBlock(Blocks.GREEN_WOOL, 0, 35F); renderHoldingItem(false, new ItemStack(InitItems.itemSwordQuartz)); renderHoldingItem(true, new ItemStack(Items.SHIELD)); } @@ -485,12 +487,13 @@ public final class SmileyCloudEasterEggs { CLOUD_STUFF.add(egg); } + // todo: migrate to matrix private static void renderHoldingItem(boolean leftHand, ItemStack stack) { GlStateManager.pushMatrix(); - GlStateManager.rotate(180F, 0F, 0F, 1F); - GlStateManager.rotate(90, 0, 1, 0); - GlStateManager.translate(-0.15, -1F, leftHand ? -0.525F : 0.525F); - GlStateManager.scale(0.75F, 0.75F, 0.75F); + GlStateManager.rotatef(180F, 0F, 0F, 1F); + GlStateManager.rotatef(90, 0, 1, 0); + GlStateManager.translatef(-0.15f, -1F, leftHand ? -0.525F : 0.525F); + GlStateManager.scalef(0.75F, 0.75F, 0.75F); AssetUtil.renderItemInWorld(stack); @@ -500,10 +503,10 @@ public final class SmileyCloudEasterEggs { private static void renderHeadBlock(Block block, int meta, float rotation) { GlStateManager.pushMatrix(); GlStateManager.disableLighting(); - GlStateManager.translate(-0.015F, 0.625F, 0.04F); - GlStateManager.scale(0.5F, 0.5F, 0.5F); - GlStateManager.rotate(180F, 1F, 0F, 0F); - GlStateManager.rotate(rotation, 0F, 1F, 0F); + GlStateManager.translatef(-0.015F, 0.625F, 0.04F); + GlStateManager.scalef(0.5F, 0.5F, 0.5F); + GlStateManager.rotatef(180F, 1F, 0F, 0F); + GlStateManager.rotatef(rotation, 0F, 1F, 0F); AssetUtil.renderBlockInWorld(block, meta); diff --git a/src/main/java/de/ellpeck/actuallyadditions/common/ore/InitOreDict.java b/src/main/java/de/ellpeck/actuallyadditions/common/ore/InitOreDict.java index b16792384..a8dfb02e3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/common/ore/InitOreDict.java +++ b/src/main/java/de/ellpeck/actuallyadditions/common/ore/InitOreDict.java @@ -1,70 +1,71 @@ -package de.ellpeck.actuallyadditions.common.ore; - -import de.ellpeck.actuallyadditions.common.ActuallyAdditions; -import de.ellpeck.actuallyadditions.common.blocks.InitBlocks; -import de.ellpeck.actuallyadditions.common.blocks.metalists.TheMiscBlocks; -import de.ellpeck.actuallyadditions.common.items.InitItems; -import de.ellpeck.actuallyadditions.common.items.metalists.TheDusts; -import de.ellpeck.actuallyadditions.common.items.metalists.TheFoods; -import de.ellpeck.actuallyadditions.common.items.metalists.TheMiscItems; -import net.minecraft.block.Block; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public final class InitOreDict { - - public static void init() { - ActuallyAdditions.LOGGER.info("Initializing OreDictionary Entries..."); - - //Vanilla Ores - addOre(Items.COAL, "coal"); - - //Ores for Pulverizers etc. - addOre(InitItems.itemDust, TheDusts.IRON.ordinal(), "dustIron"); - addOre(InitItems.itemDust, TheDusts.GOLD.ordinal(), "dustGold"); - addOre(InitItems.itemDust, TheDusts.DIAMOND.ordinal(), "dustDiamond"); - addOre(InitItems.itemDust, TheDusts.EMERALD.ordinal(), "dustEmerald"); - addOre(InitItems.itemDust, TheDusts.LAPIS.ordinal(), "dustLapis"); - addOre(InitItems.itemDust, TheDusts.QUARTZ.ordinal(), "dustQuartz"); - addOre(InitItems.itemDust, TheDusts.QUARTZ.ordinal(), "dustNetherQuartz"); - addOre(InitItems.itemDust, TheDusts.COAL.ordinal(), "dustCoal"); - addOre(InitItems.itemDust, TheDusts.QUARTZ_BLACK.ordinal(), "dustQuartzBlack"); - addOre(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), "oreQuartzBlack"); - addOre(InitItems.itemMisc, TheMiscItems.QUARTZ.ordinal(), "gemQuartzBlack"); - - //For Thermal Expansion Machine that "grows crops" - addOre(InitItems.itemCanolaSeed, "seedCanola"); - addOre(InitItems.itemMisc, TheMiscItems.CANOLA.ordinal(), "cropCanola"); - addOre(InitItems.itemRiceSeed, "seedRice"); - addOre(InitItems.itemFoods, TheFoods.RICE.ordinal(), "cropRice"); - addOre(InitItems.itemFlaxSeed, "seedFlax"); - addOre(Items.STRING, "cropFlax"); - addOre(InitItems.itemCoffeeSeed, "seedCoffee"); - addOre(InitItems.itemCoffeeBean, "cropCoffee"); - - //For Crafting - addOre(InitItems.itemMisc, TheMiscItems.RICE_SLIME.ordinal(), "slimeball"); - addOre(InitBlocks.blockMisc, TheMiscBlocks.CHARCOAL_BLOCK.ordinal(), "blockCharcoal"); - addOre(InitBlocks.blockMisc, TheMiscBlocks.QUARTZ.ordinal(), "blockQuartzBlack"); - addOre(InitItems.itemMisc, TheMiscItems.BLACK_DYE.ordinal(), "dyeBlack"); - addOre(InitItems.itemMisc, TheMiscItems.BLACK_DYE.ordinal(), "dye"); - } - - private static void addOre(Item item, int meta, String name) { - addOre(new ItemStack(item, 1, meta), name); - } - - private static void addOre(Item item, String name) { - addOre(item, 0, name); - } - - private static void addOre(Block block, int meta, String name) { - addOre(new ItemStack(block, 1, meta), name); - } - - private static void addOre(ItemStack stack, String name) { - OreDictionary.registerOre(name, stack); - } -} +// todo: remove, no longer needed but we need to migrate the system over to tags or what ever +//package de.ellpeck.actuallyadditions.common.ore; +// +//import de.ellpeck.actuallyadditions.common.ActuallyAdditions; +//import de.ellpeck.actuallyadditions.common.blocks.InitBlocks; +//import de.ellpeck.actuallyadditions.common.blocks.metalists.TheMiscBlocks; +//import de.ellpeck.actuallyadditions.common.items.InitItems; +//import de.ellpeck.actuallyadditions.common.items.metalists.TheDusts; +//import de.ellpeck.actuallyadditions.common.items.metalists.TheFoods; +//import de.ellpeck.actuallyadditions.common.items.metalists.TheMiscItems; +//import net.minecraft.block.Block; +//import net.minecraft.init.Items; +//import net.minecraft.item.Item; +//import net.minecraft.item.ItemStack; +//import net.minecraftforge.oredict.OreDictionary; +// +//public final class InitOreDict { +// +// public static void init() { +// ActuallyAdditions.LOGGER.info("Initializing OreDictionary Entries..."); +// +// //Vanilla Ores +// addOre(Items.COAL, "coal"); +// +// //Ores for Pulverizers etc. +// addOre(InitItems.itemDust, TheDusts.IRON.ordinal(), "dustIron"); +// addOre(InitItems.itemDust, TheDusts.GOLD.ordinal(), "dustGold"); +// addOre(InitItems.itemDust, TheDusts.DIAMOND.ordinal(), "dustDiamond"); +// addOre(InitItems.itemDust, TheDusts.EMERALD.ordinal(), "dustEmerald"); +// addOre(InitItems.itemDust, TheDusts.LAPIS.ordinal(), "dustLapis"); +// addOre(InitItems.itemDust, TheDusts.QUARTZ.ordinal(), "dustQuartz"); +// addOre(InitItems.itemDust, TheDusts.QUARTZ.ordinal(), "dustNetherQuartz"); +// addOre(InitItems.itemDust, TheDusts.COAL.ordinal(), "dustCoal"); +// addOre(InitItems.itemDust, TheDusts.QUARTZ_BLACK.ordinal(), "dustQuartzBlack"); +// addOre(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), "oreQuartzBlack"); +// addOre(InitItems.itemMisc, TheMiscItems.QUARTZ.ordinal(), "gemQuartzBlack"); +// +// //For Thermal Expansion Machine that "grows crops" +// addOre(InitItems.itemCanolaSeed, "seedCanola"); +// addOre(InitItems.itemMisc, TheMiscItems.CANOLA.ordinal(), "cropCanola"); +// addOre(InitItems.itemRiceSeed, "seedRice"); +// addOre(InitItems.itemFoods, TheFoods.RICE.ordinal(), "cropRice"); +// addOre(InitItems.itemFlaxSeed, "seedFlax"); +// addOre(Items.STRING, "cropFlax"); +// addOre(InitItems.itemCoffeeSeed, "seedCoffee"); +// addOre(InitItems.itemCoffeeBean, "cropCoffee"); +// +// //For Crafting +// addOre(InitItems.itemMisc, TheMiscItems.RICE_SLIME.ordinal(), "slimeball"); +// addOre(InitBlocks.blockMisc, TheMiscBlocks.CHARCOAL_BLOCK.ordinal(), "blockCharcoal"); +// addOre(InitBlocks.blockMisc, TheMiscBlocks.QUARTZ.ordinal(), "blockQuartzBlack"); +// addOre(InitItems.itemMisc, TheMiscItems.BLACK_DYE.ordinal(), "dyeBlack"); +// addOre(InitItems.itemMisc, TheMiscItems.BLACK_DYE.ordinal(), "dye"); +// } +// +// private static void addOre(Item item, int meta, String name) { +// addOre(new ItemStack(item, 1, meta), name); +// } +// +// private static void addOre(Item item, String name) { +// addOre(item, 0, name); +// } +// +// private static void addOre(Block block, int meta, String name) { +// addOre(new ItemStack(block, 1, meta), name); +// } +// +// private static void addOre(ItemStack stack, String name) { +// OreDictionary.registerOre(name, stack); +// } +//} diff --git a/src/main/java/de/ellpeck/actuallyadditions/common/particle/ParticleLaserItem.java b/src/main/java/de/ellpeck/actuallyadditions/common/particle/ParticleLaserItem.java index 33cbdef72..26fb97499 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/common/particle/ParticleLaserItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/common/particle/ParticleLaserItem.java @@ -1,5 +1,8 @@ package de.ellpeck.actuallyadditions.common.particle; +import com.mojang.blaze3d.vertex.IVertexBuilder; +import net.minecraft.client.particle.IParticleRenderType; +import net.minecraft.client.renderer.ActiveRenderInfo; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; @@ -16,7 +19,6 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) public class ParticleLaserItem extends Particle { private final double otherX; @@ -40,22 +42,12 @@ public class ParticleLaserItem extends Particle { this.motionY = motionY; this.motionZ = 0; - this.particleMaxAge = 10; + this.maxAge = 10; this.canCollide = false; } @Override - public void setExpired() { - super.setExpired(); - - if (this.otherX != 0 || this.otherY != 0 || this.otherZ != 0) { - Particle fx = new ParticleLaserItem(this.world, this.otherX, this.otherY, this.otherZ, this.stack, -0.025); - Minecraft.getMinecraft().effectRenderer.addEffect(fx); - } - } - - @Override - public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { + public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { GlStateManager.pushMatrix(); RenderHelper.enableStandardItemLighting(); @@ -79,7 +71,22 @@ public class ParticleLaserItem extends Particle { } @Override - public int getFXLayer() { - return 3; + public IParticleRenderType getRenderType() { + return IParticleRenderType.CUSTOM; } + + @Override + public void setExpired() { + super.setExpired(); + + if (this.otherX != 0 || this.otherY != 0 || this.otherZ != 0) { + Particle fx = new ParticleLaserItem(this.world, this.otherX, this.otherY, this.otherZ, this.stack, -0.025); + Minecraft.getInstance().effectRenderer.addEffect(fx); + } + } + +// @Override +// public int getFXLayer() { +// return 3; +// } }