diff --git a/build.gradle b/build.gradle index fbfd96823..7584c368d 100644 --- a/build.gradle +++ b/build.gradle @@ -27,10 +27,10 @@ boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equal // The project is named Flywheel-Forge, but sub-projects are named by folder. boolean inWorkspace = findProject(':Flywheel') != null -ext.buildnumber = 0 -project.buildnumber = System.getenv('BUILD_NUMBER') != null ? System.getenv('BUILD_NUMBER') : 'custom' +ext.buildNumber = System.getenv('BUILD_NUMBER') +if (buildNumber == null) buildNumber = 'custom' -version = "mc${minecraft_version}_v${mod_version}" + (dev && !buildnumber.equals('custom') ? "+${buildnumber}" : '') +version = "mc${minecraft_version}_v${mod_version}" + (dev && !buildNumber.equals('custom') ? "+${buildNumber}" : '') group = 'com.simibubi.create' archivesBaseName = 'create' diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index 255cb1a9a..84f52369b 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -288,16 +288,17 @@ public class AllItems { public static final ItemEntry POTATO_CANNON = REGISTRATE.item("potato_cannon", PotatoCannonItem::new) - .properties(p -> p.stacksTo(1)) .model(AssetLookup.itemModelWithPartials()) .register(); public static final ItemEntry EXTENDO_GRIP = REGISTRATE.item("extendo_grip", ExtendoGripItem::new) + .properties(p -> p.rarity(Rarity.UNCOMMON)) .model(AssetLookup.itemModelWithPartials()) .register(); public static final ItemEntry WAND_OF_SYMMETRY = REGISTRATE.item("wand_of_symmetry", SymmetryWandItem::new) + .properties(p -> p.stacksTo(1).rarity(Rarity.UNCOMMON)) .model(AssetLookup.itemModelWithPartials()) .register(); diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java index 4758635e8..44aa285ba 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java @@ -32,7 +32,6 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Rarity; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; @@ -57,8 +56,7 @@ public class SymmetryWandItem extends Item { private static final String ENABLE = "enable"; public SymmetryWandItem(Properties properties) { - super(properties.stacksTo(1) - .rarity(Rarity.UNCOMMON)); + super(properties); } @Nonnull diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java index 239c17b32..a8b1e6327 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java @@ -30,7 +30,6 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.ProjectileUtil; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Rarity; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; @@ -55,8 +54,6 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber public class ExtendoGripItem extends Item { - private static DamageSource lastActiveDamageSource; - public static final int MAX_DAMAGE = 200; public static final AttributeModifier singleRangeAttributeModifier = @@ -66,19 +63,19 @@ public class ExtendoGripItem extends Item { new AttributeModifier(UUID.fromString("8f7dbdb2-0d0d-458a-aa40-ac7633691f66"), "Range modifier", 5, AttributeModifier.Operation.ADDITION); - static Supplier> rangeModifier = Suppliers.memoize(() -> + private static final Supplier> rangeModifier = Suppliers.memoize(() -> // Holding an ExtendoGrip ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), singleRangeAttributeModifier) ); - - static Supplier> doubleRangeModifier = Suppliers.memoize(() -> + private static final Supplier> doubleRangeModifier = Suppliers.memoize(() -> // Holding two ExtendoGrips o.O ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), doubleRangeAttributeModifier) ); + private static DamageSource lastActiveDamageSource; + public ExtendoGripItem(Properties properties) { - super(properties.stacksTo(1) - .rarity(Rarity.UNCOMMON)); + super(properties.defaultDurability(MAX_DAMAGE)); } public static final String EXTENDO_MARKER = "createExtendo"; @@ -194,10 +191,10 @@ public class ExtendoGripItem extends Item { findAndDamageExtendoGrip((Player) entity); } - @SubscribeEvent(priority = EventPriority.LOWEST) - public static void consumeDurabilityOnPlace(PlayerInteractEvent event) { +// @SubscribeEvent(priority = EventPriority.LOWEST) +// public static void consumeDurabilityOnPlace(PlayerInteractEvent event) { // findAndDamageExtendoGrip(event.getPlayer()); - } +// } private static void findAndDamageExtendoGrip(Player player) { if (player == null) @@ -236,16 +233,6 @@ public class ExtendoGripItem extends Item { return AllConfigs.SERVER.curiosities.maxExtendoGripActions.get(); } - @Override - public boolean canBeDepleted() { - return true; - } - - @Override - public int getMaxDamage(ItemStack stack) { - return MAX_DAMAGE; - } - @SubscribeEvent public static void bufferLivingAttackEvent(LivingAttackEvent event) { // Workaround for removed patch to get the attacking entity. diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java index 10db29bdd..d8749856d 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java @@ -45,7 +45,7 @@ import net.minecraftforge.common.util.FakePlayer; public class SandPaperItem extends Item implements CustomUseEffectsItem { public SandPaperItem(Properties properties) { - super(properties.durability(8)); + super(properties.defaultDurability(8)); } @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItem.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItem.java index d916fa132..e593744c6 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoCannonItem.java @@ -53,7 +53,7 @@ public class PotatoCannonItem extends ProjectileWeaponItem { public static final int MAX_DAMAGE = 100; public PotatoCannonItem(Properties properties) { - super(properties); + super(properties.defaultDurability(MAX_DAMAGE)); } @Override @@ -81,11 +81,6 @@ public class PotatoCannonItem extends ProjectileWeaponItem { return use(context.getLevel(), context.getPlayer(), context.getHand()).getResult(); } - @Override - public int getItemStackLimit(ItemStack stack) { - return 1; - } - @Override public boolean isBarVisible(ItemStack stack) { return BackTankUtil.isBarVisible(stack, maxUses()); @@ -105,20 +100,10 @@ public class PotatoCannonItem extends ProjectileWeaponItem { return AllConfigs.SERVER.curiosities.maxPotatoCannonShots.get(); } - @Override - public boolean canBeDepleted() { - return true; - } - public boolean isCannon(ItemStack stack) { return stack.getItem() instanceof PotatoCannonItem; } - @Override - public int getMaxDamage(ItemStack stack) { - return MAX_DAMAGE; - } - @Override public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); @@ -275,11 +260,6 @@ public class PotatoCannonItem extends ProjectileWeaponItem { .isPresent(); } - @Override - public int getEnchantmentValue() { - return 1; - } - @Override public boolean onEntitySwing(ItemStack stack, LivingEntity entity) { return true; diff --git a/src/main/java/com/simibubi/create/content/palettes/ScoriaVertexColor.java b/src/main/java/com/simibubi/create/content/palettes/ScoriaVertexColor.java deleted file mode 100644 index 5f35c7803..000000000 --- a/src/main/java/com/simibubi/create/content/palettes/ScoriaVertexColor.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.simibubi.create.content.palettes; - -import com.simibubi.create.foundation.block.render.IBlockVertexColor; -import com.simibubi.create.foundation.utility.Color; - -public class ScoriaVertexColor implements IBlockVertexColor { - - public static final ScoriaVertexColor INSTANCE = new ScoriaVertexColor(); - - @Override - public int getColor(float x, float y, float z) { - float x2 = (float) Math.floor(z + x - y * .5); - float y2 = (float) Math.floor(y * 1.5 + x * .5 - z); - float z2 = (float) Math.floor(y - z * .5 - x); - - Color color = new Color(0x448888); - if (x2 % 2 == 0) - color.modifyValue(v -> v | 0x0011ff); - if (z2 % 2 == 0) - color.modifyValue(v -> v | 0x888888); - - color.mixWith(Color.rainbowColor((int) (x + y + z) * 170), .4f); - - if ((x2 % 4 == 0) || (y2 % 4 == 0)) - color.mixWith(Color.WHITE, .8f); - - return color.getRGB() & 0x00_ffffff; - } - -} diff --git a/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java b/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java index b0557d581..c5d51ac75 100644 --- a/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/item/SchematicItem.java @@ -56,7 +56,7 @@ public class SchematicItem extends Item { private static final Logger LOGGER = LogManager.getLogger(); public SchematicItem(Properties properties) { - super(properties.stacksTo(1)); + super(properties); } public static ItemStack create(String schematic, String owner) { diff --git a/src/main/java/com/simibubi/create/foundation/block/render/ColoredVertexModel.java b/src/main/java/com/simibubi/create/foundation/block/render/ColoredVertexModel.java deleted file mode 100644 index 4b110203a..000000000 --- a/src/main/java/com/simibubi/create/foundation/block/render/ColoredVertexModel.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.simibubi.create.foundation.block.render; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.blaze3d.vertex.VertexFormatElement; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.model.BakedModelWrapper; -import net.minecraftforge.client.model.data.IModelData; -import net.minecraftforge.client.model.data.ModelDataMap; -import net.minecraftforge.client.model.data.ModelProperty; - -public class ColoredVertexModel extends BakedModelWrapper { - - private static final ModelProperty POSITION_PROPERTY = new ModelProperty<>(); - private IBlockVertexColor color; - - public ColoredVertexModel(BakedModel originalModel, IBlockVertexColor color) { - super(originalModel); - this.color = color; - } - - @Override - public IModelData getModelData(BlockAndTintGetter world, BlockPos pos, BlockState state, IModelData tileData) { - return new ModelDataMap.Builder().withInitial(POSITION_PROPERTY, pos).build(); - } - - @Override - public List getQuads(BlockState state, Direction side, Random rand, IModelData extraData) { - List quads = super.getQuads(state, side, rand, extraData); - if (quads.isEmpty()) - return quads; - if (!extraData.hasProperty(POSITION_PROPERTY)) - return quads; - BlockPos data = extraData.getData(POSITION_PROPERTY); - quads = new ArrayList<>(quads); - - // Optifine might've rejigged vertex data - VertexFormat format = DefaultVertexFormat.BLOCK; - int colorIndex = 0; - for (int elementId = 0; elementId < format.getElements().size(); elementId++) { - VertexFormatElement element = format.getElements().get(elementId); - if (element.getUsage() == VertexFormatElement.Usage.COLOR) - colorIndex = elementId; - } - int colorOffset = format.getOffset(colorIndex) / 4; - - for (int i = 0; i < quads.size(); i++) { - BakedQuad quad = quads.get(i); - - BakedQuad newQuad = QuadHelper.clone(quad); - int[] vertexData = newQuad.getVertices(); - - for (int vertex = 0; vertex < vertexData.length; vertex += format.getIntegerSize()) { - float x = Float.intBitsToFloat(vertexData[vertex]); - float y = Float.intBitsToFloat(vertexData[vertex + 1]); - float z = Float.intBitsToFloat(vertexData[vertex + 2]); - int color = this.color.getColor(x + data.getX(), y + data.getY(), z + data.getZ()); - vertexData[vertex + colorOffset] = color; - } - - quads.set(i, newQuad); - } - return quads; - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/block/render/IBlockVertexColor.java b/src/main/java/com/simibubi/create/foundation/block/render/IBlockVertexColor.java deleted file mode 100644 index f754ed13c..000000000 --- a/src/main/java/com/simibubi/create/foundation/block/render/IBlockVertexColor.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.simibubi.create.foundation.block.render; - -@FunctionalInterface -public interface IBlockVertexColor { - - public int getColor(float x, float y, float z); - -} diff --git a/src/main/java/com/simibubi/create/foundation/config/CClient.java b/src/main/java/com/simibubi/create/foundation/config/CClient.java index 7d7bc8a29..9161ba3fb 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CClient.java +++ b/src/main/java/com/simibubi/create/foundation/config/CClient.java @@ -19,8 +19,6 @@ public class CClient extends ConfigBase { public final ConfigFloat filterItemRenderDistance = f(10f, 1, "filterItemRenderDistance", Comments.filterItemRenderDistance); public final ConfigBool rainbowDebug = b(true, "enableRainbowDebug", Comments.rainbowDebug); - public final ConfigBool experimentalRendering = b(true, "experimentalRendering", - Comments.experimentalRendering); public final ConfigInt maxContraptionLightVolume = i(16384, 0, Integer.MAX_VALUE, "maximumContraptionLightVolume", Comments.maxContraptionLightVolume); // no group @@ -95,7 +93,6 @@ public class CClient extends ConfigBase { "Maximum Distance to the player at which items in Blocks' filter slots will be displayed" }; static String rainbowDebug = "Show colourful debug information while the F3-Menu is open."; - static String experimentalRendering = "Use modern OpenGL features to drastically increase performance."; static String maxContraptionLightVolume = "The maximum amount of blocks for which to try and calculate dynamic contraption lighting. Decrease if large contraption cause too much lag"; static String[] mainMenuConfigButtonRow = new String[]{ "Choose the menu row that the Create config button appears on in the main menu", diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java index f69cee7ce..7a1e8502b 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java @@ -18,8 +18,6 @@ import com.simibubi.create.content.contraptions.fluids.VirtualFluid; import com.simibubi.create.content.contraptions.relays.encased.CasingConnectivity; import com.simibubi.create.foundation.block.connected.CTModel; import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour; -import com.simibubi.create.foundation.block.render.ColoredVertexModel; -import com.simibubi.create.foundation.block.render.IBlockVertexColor; import com.tterrag.registrate.AbstractRegistrate; import com.tterrag.registrate.builders.BlockBuilder; import com.tterrag.registrate.builders.BlockEntityBuilder.BlockEntityFactory; @@ -198,10 +196,6 @@ public class CreateRegistrate extends AbstractRegistrate { return entry -> onClient(() -> () -> registerCasingConnectivity(entry, consumer)); } - public static NonNullConsumer blockVertexColors(IBlockVertexColor colorFunc) { - return entry -> onClient(() -> () -> registerBlockVertexColor(entry, colorFunc)); - } - public static NonNullConsumer blockModel( Supplier> func) { return entry -> onClient(() -> () -> registerBlockModel(entry, func)); @@ -229,12 +223,6 @@ public class CreateRegistrate extends AbstractRegistrate { consumer.accept(entry, CreateClient.CASING_CONNECTIVITY); } - @OnlyIn(Dist.CLIENT) - private static void registerBlockVertexColor(Block entry, IBlockVertexColor colorFunc) { - CreateClient.MODEL_SWAPPER.getCustomBlockModels() - .register(entry.delegate, model -> new ColoredVertexModel(model, colorFunc)); - } - @OnlyIn(Dist.CLIENT) private static void registerBlockModel(Block entry, Supplier> func) { diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperRenderTypeBuffer.java b/src/main/java/com/simibubi/create/foundation/render/SuperRenderTypeBuffer.java index 0267feeed..57716c382 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperRenderTypeBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperRenderTypeBuffer.java @@ -15,7 +15,7 @@ import net.minecraft.client.resources.model.ModelBakery; public class SuperRenderTypeBuffer implements MultiBufferSource { - private static final SuperRenderTypeBuffer INSTANCE = new SuperRenderTypeBuffer();; + private static final SuperRenderTypeBuffer INSTANCE = new SuperRenderTypeBuffer(); public static SuperRenderTypeBuffer getInstance() { return INSTANCE; diff --git a/src/main/java/com/simibubi/create/foundation/utility/AnimationTickHolder.java b/src/main/java/com/simibubi/create/foundation/utility/AnimationTickHolder.java index 9742d9b7e..091326516 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/AnimationTickHolder.java +++ b/src/main/java/com/simibubi/create/foundation/utility/AnimationTickHolder.java @@ -10,11 +10,11 @@ import net.minecraft.world.level.LevelAccessor; public class AnimationTickHolder { private static int ticks; - private static int paused_ticks; + private static int pausedTicks; public static void reset() { ticks = 0; - paused_ticks = 0; + pausedTicks = 0; } public static void tick() { @@ -22,7 +22,7 @@ public class AnimationTickHolder { .isPaused()) { ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision } else { - paused_ticks = (paused_ticks + 1) % 1_728_000; + pausedTicks = (pausedTicks + 1) % 1_728_000; } } @@ -31,7 +31,7 @@ public class AnimationTickHolder { } public static int getTicks(boolean includePaused) { - return includePaused ? ticks + paused_ticks : ticks; + return includePaused ? ticks + pausedTicks : ticks; } public static float getRenderTime() {