• Java Arrays
  • Java Strings
  • Java Collection
  • Java 8 Tutorial
  • Java Multithreading
  • Java Exception Handling
  • Java Programs
  • Java Project
  • Java Collections Interview
  • Java Interview Questions
  • Spring Boot
  • Java Tutorial

Overview of Java

  • Introduction to Java
  • The Complete History of Java Programming Language
  • C++ vs Java vs Python
  • How to Download and Install Java for 64 bit machine?
  • Setting up the environment in Java
  • How to Download and Install Eclipse on Windows?
  • JDK in Java
  • How JVM Works - JVM Architecture?
  • Differences between JDK, JRE and JVM
  • Just In Time Compiler
  • Difference between JIT and JVM in Java
  • Difference between Byte Code and Machine Code
  • How is Java platform independent?

Basics of Java

  • Java Basic Syntax
  • Java Hello World Program
  • Java Data Types
  • Primitive data type vs. Object data type in Java with Examples
  • Java Identifiers

Operators in Java

  • Java Variables
  • Scope of Variables In Java

Wrapper Classes in Java

Input/output in java.

  • How to Take Input From User in Java?
  • Scanner Class in Java
  • Java.io.BufferedReader Class in Java
  • Difference Between Scanner and BufferedReader Class in Java
  • Ways to read input from console in Java
  • System.out.println in Java
  • Difference between print() and println() in Java
  • Formatted Output in Java using printf()
  • Fast I/O in Java in Competitive Programming

Flow Control in Java

  • Decision Making in Java (if, if-else, switch, break, continue, jump)
  • Java if statement with Examples
  • Java if-else
  • Java if-else-if ladder with Examples
  • Loops in Java
  • For Loop in Java
  • Java while loop with Examples
  • Java do-while loop with Examples
  • For-each loop in Java
  • Continue Statement in Java
  • Break statement in Java
  • Usage of Break keyword in Java
  • return keyword in Java
  • Java Arithmetic Operators with Examples
  • Java Unary Operator with Examples

Java Assignment Operators with Examples

  • Java Relational Operators with Examples
  • Java Logical Operators with Examples
  • Java Ternary Operator with Examples
  • Bitwise Operators in Java
  • Strings in Java
  • String class in Java
  • Java.lang.String class in Java | Set 2
  • Why Java Strings are Immutable?
  • StringBuffer class in Java
  • StringBuilder Class in Java with Examples
  • String vs StringBuilder vs StringBuffer in Java
  • StringTokenizer Class in Java
  • StringTokenizer Methods in Java with Examples | Set 2
  • StringJoiner Class in Java
  • Arrays in Java
  • Arrays class in Java
  • Multidimensional Arrays in Java
  • Different Ways To Declare And Initialize 2-D Array in Java
  • Jagged Array in Java
  • Final Arrays in Java
  • Reflection Array Class in Java
  • util.Arrays vs reflect.Array in Java with Examples

OOPS in Java

  • Object Oriented Programming (OOPs) Concept in Java
  • Why Java is not a purely Object-Oriented Language?
  • Classes and Objects in Java
  • Naming Conventions in Java
  • Java Methods

Access Modifiers in Java

  • Java Constructors
  • Four Main Object Oriented Programming Concepts of Java

Inheritance in Java

Abstraction in java, encapsulation in java, polymorphism in java, interfaces in java.

  • 'this' reference in Java
  • Inheritance and Constructors in Java
  • Java and Multiple Inheritance
  • Interfaces and Inheritance in Java
  • Association, Composition and Aggregation in Java
  • Comparison of Inheritance in C++ and Java
  • abstract keyword in java
  • Abstract Class in Java
  • Difference between Abstract Class and Interface in Java
  • Control Abstraction in Java with Examples
  • Difference Between Data Hiding and Abstraction in Java
  • Difference between Abstraction and Encapsulation in Java with Examples
  • Difference between Inheritance and Polymorphism
  • Dynamic Method Dispatch or Runtime Polymorphism in Java
  • Difference between Compile-time and Run-time Polymorphism in Java

Constructors in Java

  • Copy Constructor in Java
  • Constructor Overloading in Java
  • Constructor Chaining In Java with Examples
  • Private Constructors and Singleton Classes in Java

Methods in Java

  • Static methods vs Instance methods in Java
  • Abstract Method in Java with Examples
  • Overriding in Java
  • Method Overloading in Java
  • Difference Between Method Overloading and Method Overriding in Java
  • Differences between Interface and Class in Java
  • Functional Interfaces in Java
  • Nested Interface in Java
  • Marker interface in Java
  • Comparator Interface in Java with Examples
  • Need of Wrapper Classes in Java
  • Different Ways to Create the Instances of Wrapper Classes in Java
  • Character Class in Java
  • Java.Lang.Byte class in Java
  • Java.Lang.Short class in Java
  • Java.lang.Integer class in Java
  • Java.Lang.Long class in Java
  • Java.Lang.Float class in Java
  • Java.Lang.Double Class in Java
  • Java.lang.Boolean Class in Java
  • Autoboxing and Unboxing in Java
  • Type conversion in Java with Examples

Keywords in Java

  • Java Keywords
  • Important Keywords in Java
  • Super Keyword in Java
  • final Keyword in Java
  • static Keyword in Java
  • enum in Java
  • transient keyword in Java
  • volatile Keyword in Java
  • final, finally and finalize in Java
  • Public vs Protected vs Package vs Private Access Modifier in Java
  • Access and Non Access Modifiers in Java

Memory Allocation in Java

  • Java Memory Management
  • How are Java objects stored in memory?
  • Stack vs Heap Memory Allocation
  • How many types of memory areas are allocated by JVM?
  • Garbage Collection in Java
  • Types of JVM Garbage Collectors in Java with implementation details
  • Memory leaks in Java
  • Java Virtual Machine (JVM) Stack Area

Classes of Java

  • Understanding Classes and Objects in Java
  • Singleton Method Design Pattern in Java
  • Object Class in Java
  • Inner Class in Java
  • Throwable Class in Java with Examples

Packages in Java

  • Packages In Java
  • How to Create a Package in Java?
  • Java.util Package in Java
  • Java.lang package in Java
  • Java.io Package in Java
  • Java Collection Tutorial

Exception Handling in Java

  • Exceptions in Java
  • Types of Exception in Java with Examples
  • Checked vs Unchecked Exceptions in Java
  • Java Try Catch Block
  • Flow control in try catch finally in Java
  • throw and throws in Java
  • User-defined Custom Exception in Java
  • Chained Exceptions in Java
  • Null Pointer Exception In Java
  • Exception Handling with Method Overriding in Java
  • Multithreading in Java
  • Lifecycle and States of a Thread in Java
  • Java Thread Priority in Multithreading
  • Main thread in Java
  • Java.lang.Thread Class in Java
  • Runnable interface in Java
  • Naming a thread and fetching name of current thread in Java
  • What does start() function do in multithreading in Java?
  • Difference between Thread.start() and Thread.run() in Java
  • Thread.sleep() Method in Java With Examples
  • Synchronization in Java
  • Importance of Thread Synchronization in Java
  • Method and Block Synchronization in Java
  • Lock framework vs Thread synchronization in Java
  • Difference Between Atomic, Volatile and Synchronized in Java
  • Deadlock in Java Multithreading
  • Deadlock Prevention And Avoidance
  • Difference Between Lock and Monitor in Java Concurrency
  • Reentrant Lock in Java

File Handling in Java

  • Java.io.File Class in Java
  • Java Program to Create a New File
  • Different ways of Reading a text file in Java
  • Java Program to Write into a File
  • Delete a File Using Java
  • File Permissions in Java
  • FileWriter Class in Java
  • Java.io.FileDescriptor in Java
  • Java.io.RandomAccessFile Class Method | Set 1
  • Regular Expressions in Java
  • Regex Tutorial - How to write Regular Expressions?
  • Matcher pattern() method in Java with Examples
  • Pattern pattern() method in Java with Examples
  • Quantifiers in Java
  • java.lang.Character class methods | Set 1
  • Java IO : Input-output in Java with Examples
  • Java.io.Reader class in Java
  • Java.io.Writer Class in Java
  • Java.io.FileInputStream Class in Java
  • FileOutputStream in Java
  • Java.io.BufferedOutputStream class in Java
  • Java Networking
  • TCP/IP Model
  • User Datagram Protocol (UDP)
  • Differences between IPv4 and IPv6
  • Difference between Connection-oriented and Connection-less Services
  • Socket Programming in Java
  • java.net.ServerSocket Class in Java
  • URL Class in Java with Examples

JDBC - Java Database Connectivity

  • Introduction to JDBC (Java Database Connectivity)
  • JDBC Drivers
  • Establishing JDBC Connection in Java
  • Types of Statements in JDBC
  • JDBC Tutorial
  • Java 8 Features - Complete Tutorial

Operators constitute the basic building block of any programming language. Java too provides many types of operators which can be used according to the need to perform various calculations and functions, be it logical, arithmetic, relational, etc. They are classified based on the functionality they provide.

Types of Operators: 

  • Arithmetic Operators
  • Unary Operators
  • Assignment Operator
  • Relational Operators
  • Logical Operators
  • Ternary Operator
  • Bitwise Operators
  • Shift Operators

This article explains all that one needs to know regarding Assignment Operators. 

Assignment Operators

These operators are used to assign values to a variable. The left side operand of the assignment operator is a variable, and the right side operand of the assignment operator is a value. The value on the right side must be of the same data type of the operand on the left side. Otherwise, the compiler will raise an error. This means that the assignment operators have right to left associativity, i.e., the value given on the right-hand side of the operator is assigned to the variable on the left. Therefore, the right-hand side value must be declared before using it or should be a constant. The general format of the assignment operator is, 

Types of Assignment Operators in Java

The Assignment Operator is generally of two types. They are:

1. Simple Assignment Operator: The Simple Assignment Operator is used with the “=” sign where the left side consists of the operand and the right side consists of a value. The value of the right side must be of the same data type that has been defined on the left side.

2. Compound Assignment Operator: The Compound Operator is used where +,-,*, and / is used along with the = operator.

Let’s look at each of the assignment operators and how they operate: 

1. (=) operator: 

This is the most straightforward assignment operator, which is used to assign the value on the right to the variable on the left. This is the basic definition of an assignment operator and how it functions. 

Syntax:  

Example:  

2. (+=) operator: 

This operator is a compound of ‘+’ and ‘=’ operators. It operates by adding the current value of the variable on the left to the value on the right and then assigning the result to the operand on the left. 

Note: The compound assignment operator in Java performs implicit type casting. Let’s consider a scenario where x is an int variable with a value of 5. int x = 5; If you want to add the double value 4.5 to the integer variable x and print its value, there are two methods to achieve this: Method 1: x = x + 4.5 Method 2: x += 4.5 As per the previous example, you might think both of them are equal. But in reality, Method 1 will throw a runtime error stating the “i ncompatible types: possible lossy conversion from double to int “, Method 2 will run without any error and prints 9 as output.

Reason for the Above Calculation

Method 1 will result in a runtime error stating “incompatible types: possible lossy conversion from double to int.” The reason is that the addition of an int and a double results in a double value. Assigning this double value back to the int variable x requires an explicit type casting because it may result in a loss of precision. Without the explicit cast, the compiler throws an error. Method 2 will run without any error and print the value 9 as output. The compound assignment operator += performs an implicit type conversion, also known as an automatic narrowing primitive conversion from double to int . It is equivalent to x = (int) (x + 4.5) , where the result of the addition is explicitly cast to an int . The fractional part of the double value is truncated, and the resulting int value is assigned back to x . It is advisable to use Method 2 ( x += 4.5 ) to avoid runtime errors and to obtain the desired output.

Same automatic narrowing primitive conversion is applicable for other compound assignment operators as well, including -= , *= , /= , and %= .

3. (-=) operator: 

This operator is a compound of ‘-‘ and ‘=’ operators. It operates by subtracting the variable’s value on the right from the current value of the variable on the left and then assigning the result to the operand on the left. 

4. (*=) operator:

 This operator is a compound of ‘*’ and ‘=’ operators. It operates by multiplying the current value of the variable on the left to the value on the right and then assigning the result to the operand on the left. 

5. (/=) operator: 

This operator is a compound of ‘/’ and ‘=’ operators. It operates by dividing the current value of the variable on the left by the value on the right and then assigning the quotient to the operand on the left. 

6. (%=) operator: 

This operator is a compound of ‘%’ and ‘=’ operators. It operates by dividing the current value of the variable on the left by the value on the right and then assigning the remainder to the operand on the left. 

Please Login to comment...

Similar reads.

  • Java-Operators

advertisewithusBannerImg

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

Java Tutorial

Java methods, java classes, java file handling, java how to, java reference, java examples, java operators.

Operators are used to perform operations on variables and values.

In the example below, we use the + operator to add together two values:

Try it Yourself »

Although the + operator is often used to add together two values, like in the example above, it can also be used to add together a variable and a value, or a variable and another variable:

Java divides the operators into the following groups:

  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Logical operators
  • Bitwise operators

Arithmetic Operators

Arithmetic operators are used to perform common mathematical operations.

Advertisement

Java Assignment Operators

Assignment operators are used to assign values to variables.

In the example below, we use the assignment operator ( = ) to assign the value 10 to a variable called x :

The addition assignment operator ( += ) adds a value to a variable:

A list of all assignment operators:

Java Comparison Operators

Comparison operators are used to compare two values (or variables). This is important in programming, because it helps us to find answers and make decisions.

The return value of a comparison is either true or false . These values are known as Boolean values , and you will learn more about them in the Booleans and If..Else chapter.

In the following example, we use the greater than operator ( > ) to find out if 5 is greater than 3:

Java Logical Operators

You can also test for true or false values with logical operators.

Logical operators are used to determine the logic between variables or values:

Java Bitwise Operators

Bitwise operators are used to perform binary logic with the bits of an integer or long integer.

Note: The Bitwise examples above use 4-bit unsigned examples, but Java uses 32-bit signed integers and 64-bit signed long integers. Because of this, in Java, ~5 will not return 10. It will return -6. ~00000000000000000000000000000101 will return 11111111111111111111111111111010

In Java, 9 >> 1 will not return 12. It will return 4. 00000000000000000000000000001001 >> 1 will return 00000000000000000000000000000100

Test Yourself With Exercises

Multiply 10 with 5 , and print the result.

Start the Exercise

Get Certified

COLOR PICKER

colorpicker

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected]

Top Tutorials

Top references, top examples, get certified.

Learn Java practically and Get Certified .

Popular Tutorials

Popular examples, reference materials, learn java interactively, java introduction.

  • Get Started With Java
  • Your First Java Program
  • Java Comments

Java Fundamentals

  • Java Variables and Literals
  • Java Data Types (Primitive)

Java Operators

  • Java Basic Input and Output
  • Java Expressions, Statements and Blocks

Java Flow Control

  • Java if...else Statement

Java Ternary Operator

  • Java for Loop
  • Java for-each Loop
  • Java while and do...while Loop
  • Java break Statement
  • Java continue Statement
  • Java switch Statement
  • Java Arrays
  • Java Multidimensional Arrays
  • Java Copy Arrays

Java OOP(I)

  • Java Class and Objects
  • Java Methods
  • Java Method Overloading
  • Java Constructors
  • Java Static Keyword
  • Java Strings
  • Java Access Modifiers
  • Java this Keyword
  • Java final keyword
  • Java Recursion

Java instanceof Operator

Java OOP(II)

  • Java Inheritance
  • Java Method Overriding
  • Java Abstract Class and Abstract Methods
  • Java Interface
  • Java Polymorphism
  • Java Encapsulation

Java OOP(III)

  • Java Nested and Inner Class
  • Java Nested Static Class
  • Java Anonymous Class
  • Java Singleton Class
  • Java enum Constructor
  • Java enum Strings
  • Java Reflection
  • Java Package
  • Java Exception Handling
  • Java Exceptions
  • Java try...catch
  • Java throw and throws
  • Java catch Multiple Exceptions
  • Java try-with-resources
  • Java Annotations
  • Java Annotation Types
  • Java Logging
  • Java Assertions
  • Java Collections Framework
  • Java Collection Interface
  • Java ArrayList
  • Java Vector
  • Java Stack Class
  • Java Queue Interface
  • Java PriorityQueue
  • Java Deque Interface
  • Java LinkedList
  • Java ArrayDeque
  • Java BlockingQueue
  • Java ArrayBlockingQueue
  • Java LinkedBlockingQueue
  • Java Map Interface
  • Java HashMap
  • Java LinkedHashMap
  • Java WeakHashMap
  • Java EnumMap
  • Java SortedMap Interface
  • Java NavigableMap Interface
  • Java TreeMap
  • Java ConcurrentMap Interface
  • Java ConcurrentHashMap
  • Java Set Interface
  • Java HashSet Class
  • Java EnumSet
  • Java LinkedHashSet
  • Java SortedSet Interface
  • Java NavigableSet Interface
  • Java TreeSet
  • Java Algorithms
  • Java Iterator Interface
  • Java ListIterator Interface

Java I/o Streams

  • Java I/O Streams
  • Java InputStream Class
  • Java OutputStream Class
  • Java FileInputStream Class
  • Java FileOutputStream Class
  • Java ByteArrayInputStream Class
  • Java ByteArrayOutputStream Class
  • Java ObjectInputStream Class
  • Java ObjectOutputStream Class
  • Java BufferedInputStream Class
  • Java BufferedOutputStream Class
  • Java PrintStream Class

Java Reader/Writer

  • Java File Class
  • Java Reader Class
  • Java Writer Class
  • Java InputStreamReader Class
  • Java OutputStreamWriter Class
  • Java FileReader Class
  • Java FileWriter Class
  • Java BufferedReader
  • Java BufferedWriter Class
  • Java StringReader Class
  • Java StringWriter Class
  • Java PrintWriter Class

Additional Topics

  • Java Keywords and Identifiers

Java Operator Precedence

Java Bitwise and Shift Operators

  • Java Scanner Class
  • Java Type Casting
  • Java Wrapper Class
  • Java autoboxing and unboxing
  • Java Lambda Expressions
  • Java Generics
  • Nested Loop in Java
  • Java Command-Line Arguments

Java Tutorials

  • Java Math IEEEremainder()

Operators are symbols that perform operations on variables and values. For example, + is an operator used for addition, while * is also an operator used for multiplication.

Operators in Java can be classified into 5 types:

  • Arithmetic Operators
  • Assignment Operators
  • Relational Operators
  • Logical Operators
  • Unary Operators
  • Bitwise Operators

1. Java Arithmetic Operators

Arithmetic operators are used to perform arithmetic operations on variables and data. For example,

Here, the + operator is used to add two variables a and b . Similarly, there are various other arithmetic operators in Java.

Example 1: Arithmetic Operators

In the above example, we have used + , - , and * operators to compute addition, subtraction, and multiplication operations.

/ Division Operator

Note the operation, a / b in our program. The / operator is the division operator.

If we use the division operator with two integers, then the resulting quotient will also be an integer. And, if one of the operands is a floating-point number, we will get the result will also be in floating-point.

% Modulo Operator

The modulo operator % computes the remainder. When a = 7 is divided by b = 4 , the remainder is 3 .

Note : The % operator is mainly used with integers.

2. Java Assignment Operators

Assignment operators are used in Java to assign values to variables. For example,

Here, = is the assignment operator. It assigns the value on its right to the variable on its left. That is, 5 is assigned to the variable age .

Let's see some more assignment operators available in Java.

Example 2: Assignment Operators

3. java relational operators.

Relational operators are used to check the relationship between two operands. For example,

Here, < operator is the relational operator. It checks if a is less than b or not.

It returns either true or false .

Example 3: Relational Operators

Note : Relational operators are used in decision making and loops.

4. Java Logical Operators

Logical operators are used to check whether an expression is true or false . They are used in decision making.

Example 4: Logical Operators

Working of Program

  • (5 > 3) && (8 > 5) returns true because both (5 > 3) and (8 > 5) are true .
  • (5 > 3) && (8 < 5) returns false because the expression (8 < 5) is false .
  • (5 < 3) || (8 > 5) returns true because the expression (8 > 5) is true .
  • (5 > 3) || (8 < 5) returns true because the expression (5 > 3) is true .
  • (5 < 3) || (8 < 5) returns false because both (5 < 3) and (8 < 5) are false .
  • !(5 == 3) returns true because 5 == 3 is false .
  • !(5 > 3) returns false because 5 > 3 is true .

5. Java Unary Operators

Unary operators are used with only one operand. For example, ++ is a unary operator that increases the value of a variable by 1 . That is, ++5 will return 6 .

Different types of unary operators are:

  • Increment and Decrement Operators

Java also provides increment and decrement operators: ++ and -- respectively. ++ increases the value of the operand by 1 , while -- decrease it by 1 . For example,

Here, the value of num gets increased to 6 from its initial value of 5 .

Example 5: Increment and Decrement Operators

In the above program, we have used the ++ and -- operator as prefixes (++a, --b) . We can also use these operators as postfix (a++, b++) .

There is a slight difference when these operators are used as prefix versus when they are used as a postfix.

To learn more about these operators, visit increment and decrement operators .

6. Java Bitwise Operators

Bitwise operators in Java are used to perform operations on individual bits. For example,

Here, ~ is a bitwise operator. It inverts the value of each bit ( 0 to 1 and 1 to 0 ).

The various bitwise operators present in Java are:

These operators are not generally used in Java. To learn more, visit Java Bitwise and Bit Shift Operators .

Other operators

Besides these operators, there are other additional operators in Java.

The instanceof operator checks whether an object is an instanceof a particular class. For example,

Here, str is an instance of the String class. Hence, the instanceof operator returns true . To learn more, visit Java instanceof .

The ternary operator (conditional operator) is shorthand for the if-then-else statement. For example,

Here's how it works.

  • If the Expression is true , expression1 is assigned to the variable .
  • If the Expression is false , expression2 is assigned to the variable .

Let's see an example of a ternary operator.

In the above example, we have used the ternary operator to check if the year is a leap year or not. To learn more, visit the Java ternary operator .

Now that you know about Java operators, it's time to know about the order in which operators are evaluated. To learn more, visit Java Operator Precedence .

Table of Contents

  • Introduction
  • Java Arithmetic Operators
  • Java Assignment Operators
  • Java Relational Operators
  • Java Logical Operators
  • Java Unary Operators
  • Java Bitwise Operators

Sorry about that.

Related Tutorials

Java Tutorial

  • Enterprise Java
  • Web-based Java
  • Data & Java
  • Project Management
  • Visual Basic
  • Ruby / Rails
  • Java Mobile
  • Architecture & Design
  • Open Source
  • Web Services

Developer.com

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More .

Java Programming tutorials

Java provides many types of operators to perform a variety of calculations and functions, such as logical , arithmetic , relational , and others. With so many operators to choose from, it helps to group them based on the type of functionality they provide. This programming tutorial will focus on Java’s numerous a ssignment operators.

Before we begin, however, you may want to bookmark our other tutorials on Java operators, which include:

  • Arithmetic Operators
  • Comparison Operators
  • Conditional Operators
  • Logical Operators
  • Bitwise and Shift Operators

Assignment Operators in Java

As the name conveys, assignment operators are used to assign values to a variable using the following syntax:

The left side operand of the assignment operator must be a variable, whereas the right side operand of the assignment operator may be a literal value or another variable. Moreover, the value or variable on the right side must be of the same data type of the operand on the left side. Otherwise, the compiler will raise an error. Assignment operators have a right to left associativity in that the value given on the right-hand side of the operator is assigned to the variable on the left. Therefore, the right-hand side variable must be declared before assignment.

You can learn more about variables in our programming tutorial: Working with Java Variables .

Types of Assignment Operators in Java

Java assignment operators are classified into two types: simple and compound .

The Simple assignment operator is the equals ( = ) sign, which is the most straightforward of the bunch. It simply assigns the value or variable on the right to the variable on the left.

Compound operators are comprised of both an arithmetic, bitwise, or shift operator in addition to the equals ( = ) sign.

Equals Operator (=) Java Example

First, let’s learn to use the one-and-only simple assignment operator – the Equals ( = ) operator – with the help of a Java program. It includes two assignments: a literal value to num1 and the num1 variable to num2 , after which both are printed to the console to show that the values have been assigned to the numbers:

The += Operator Java Example

A compound of the + and = operators, the += adds the current value of the variable on the left to the value on the right before assigning the result to the operand on the left. Here is some sample code to demonstrate how to use the += operator in Java:

The -= Operator Java Example

Made up of the – and = operators, the -= first subtracts the variable’s value on the right from the current value of the variable on the left before assigning the result to the operand on the left. We can see it at work below in the following code example showing how to decrement in Java using the -= operator:

The *= Operator Java Example

This Java operator is comprised of the * and = operators. It operates by multiplying the current value of the variable on the left to the value on the right and then assigning the result to the operand on the left. Here’s a program that shows the *= operator in action:

The /= Operator Java Example

A combination of the / and = operators, the /= Operator divides the current value of the variable on the left by the value on the right and then assigns the quotient to the operand on the left. Here is some example code showing how to use the  /= operator in Java:

%= Operator Java Example

The %= operator includes both the % and = operators. As seen in the program below, it divides the current value of the variable on the left by the value on the right and then assigns the remainder to the operand on the left:

Compound Bitwise and Shift Operators in Java

The Bitwise and Shift Operators that we just recently covered can also be utilized in compound form as seen in the list below:

  • &= – Compound bitwise Assignment operator.
  • ^= – Compound bitwise ^ assignment operator.
  • >>= – Compound right shift assignment operator.
  • >>>= – Compound right shift filled 0 assignment operator.
  • <<= – Compound left shift assignment operator.

The following program demonstrates the working of all the Compound Bitwise and Shift Operators :

Final Thoughts on Java Assignment Operators

This programming tutorial presented an overview of Java’s simple and compound assignment Operators. An essential building block to any programming language, developers would be unable to store any data in their programs without them. Though not quite as indispensable as the equals operator, compound operators are great time savers, allowing you to perform arithmetic and bitwise operations and assignment in a single line of code.

Read more Java programming tutorials and guides to software development .

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

What is the role of a project manager in software development, how to use optional in java, overview of the jad methodology, microsoft project tips and tricks, how to become a project manager in 2023, related stories, understanding types of thread synchronization errors in java, understanding memory consistency in java threads.

Developer.com

Paul Clapham wrote: You mentioned assignments, which is true, but be careful, it's not only = which causes an assignment. Using a value as a method parameter also assigns that value to something,
Anil Philip wrote: The increment operators . . . have identical effects . . . Is my understanding correct?
Stephan van Hulst wrote: [tt] whenever you use them as part of a larger expression.
Anil Philip wrote: . . . Isn't it a special case of an assignment to a temporary variable in the expression?
. . . don't know how this thread ended up in the JDBC forum . . .
Campbell Ritchie wrote: No. That is part of the definition of the ++ and -- operators. It's all in the JLS.
Anil Philip wrote: . . . is equivalent to . . .
Anil Philip wrote: from Stefan's example [...] is really [...] an assignment to a temporary
Anil Philip wrote: Perhaps they should be referred to as assignment operators !
Anil Philip wrote: . . . Perhaps they should be referred to as assignment operators !
Mike Simmons wrote: Here's some sample code to study, with no assignment statements.  Can you explain the results?
i 1 i++ * i++  2 i 3 j 1 j++ * ++j  3 j 3 k 1 ++k * ++k  6 k 3
This morning, I wrote: . . . I haven't got the time now to find the page number (sorry).
Mike Simmons wrote: . . .  Can you explain the results?
Stephan van Hulst wrote: i++ and ++i are expressions. . . . .
Mike Simmons wrote: For Anil: so do you agree there is a difference between pre and post operators, outside of any assignment?
Anil Philip wrote: For the same kind of operator, there is no difference between pre and post operations - outside of an assignment.
Paul Clapham wrote: Anil Philip wrote: For the same kind of operator, there is no difference between pre and post operations - outside of an assignment.
Anil Philip wrote: I meant that ++i; and i++; result in the same value.
Paul Clapham wrote: but you made a statement about the values of those expressions. Not the same.
Anil Philip wrote: Paul Clapham wrote: but you made a statement about the values of those expressions. Not the same.
Raphaelle Senger wrote: The primary difference between these operators is not just in assignments, but in how they behave in expressions and how the value is used:
Anil Philip wrote: I did not say expressions, I said operators.
Anil Philip wrote: Raphaelle Senger wrote: The primary difference between these operators is not just in assignments, but in how they behave in expressions and how the value is used:
Mike Simmons wrote: So Anil, between System.out.println(i++ * i++); and System.out.println(++i * ++i); Is there any difference in the result?  Are there any assignments in those statements?
Anil Philip wrote: Mike Simmons wrote: For Anil: so do you agree there is a difference between pre and post operators, outside of any assignment?
Mike Simmons wrote: Why thank you?  He's right, of course.  But you're telling us that there is no difference, and he's telling you there's a difference.  Did you suddenly understand?  Are you changing your answer?
Anil Philip wrote: Mike Simmons wrote: So Anil, between System.out.println(i++ * i++); and System.out.println(++i * ++i); Is there any difference in the result?  Are there any assignments in those statements?
Anil Philip wrote: . . . There could be a temporary variable(s) . . .
Campbell Ritchie wrote: Anil Philip wrote: . . . There could be a temporary variable(s) . . .
Anil Philip wrote: . . . when the compiler translates it into assembler . . .

The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available. See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases. See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.

Summary of Operators

The following quick reference summarizes the operators supported by the Java programming language.

Simple Assignment Operator

Arithmetic operators, unary operators, equality and relational operators, conditional operators, type comparison operator, bitwise and bit shift operators.

About Oracle | Contact Us | Legal Notices | Terms of Use | Your Privacy Rights

Copyright © 1995, 2022 Oracle and/or its affiliates. All rights reserved.

  • TutorialKart
  • SAP Tutorials
  • Salesforce Admin
  • Salesforce Developer
  • Visualforce
  • Informatica
  • Kafka Tutorial
  • Spark Tutorial
  • Tomcat Tutorial
  • Python Tkinter

Programming

  • Bash Script
  • Julia Tutorial
  • CouchDB Tutorial
  • MongoDB Tutorial
  • PostgreSQL Tutorial
  • Android Compose
  • Flutter Tutorial
  • Kotlin Android

Web & Server

  • Selenium Java
  • Java Basics
  • Java Tutorial
  • Java HelloWorld Program
  • Java Program Structure
  • Java Datatypes
  • Java Variable Types
  • Java Access Modifiers
  • Java Operators
  • Java Decision Making
  • Print array
  • Initialize array
  • Array of integers
  • Array of strings
  • Array of objects
  • Array of arrays
  • Iterate over array
  • Array For loop
  • Array while loop
  • Append element to array
  • Check if array is empty
  • Array average
  • Check if array contains
  • Array ForEach
  • Array - Find Index of Item
  • Concatenate arrays
  • Find smallest number in array
  • Find largest number in array
  • Array reverse
  • Classes and Objects
  • Inheritance
  • Polymorphism
  • Method Overloading
  • Method Overriding/
  • Abstraction
  • Abstract methods and classes
  • Encapsulation
  • Print string
  • Read string from console
  • Create string from Char array
  • Create string from Byte array
  • Concatenate two strings
  • Get index of the first Occurrence of substring
  • Get index of nth occurrence of substring
  • Check if two strings are equal
  • Check if string ends with specific suffix
  • Check if string starts with specific prefix
  • Check if string is blank
  • Check if string is empty
  • Check if string contains search substring
  • Validate if string is a Phone Number
  • Character Level
  • Get character at specific index in string
  • Get first character in string
  • Get last character from string
  • Transformations
  • Replace first occurrence of string
  • Replace all occurrences of a string
  • Join strings
  • Join strings in string array
  • Join strings in ArrayList
  • Reverse a string
  • Trim string
  • Split string
  • Remove whitespaces in string
  • Replace multiple spaces with single space
  • Comparisons
  • Compare strings lexicographically
  • Compare String and CharSequence
  • Compare String and StringBuffer
  • Java Exception Handling StringIndexOutOfBoundsException
  • Convert string to int
  • Convert string to float
  • Convert string to double
  • Convert string to long
  • Convert string to boolean
  • Convert int to string
  • Convert int to float
  • Convert int to double
  • Convert int to long
  • Convert int to char
  • Convert float to string
  • Convert float to int
  • Convert float to double
  • Convert float to long
  • Convert long to string
  • Convert long to float
  • Convert long to double
  • Convert long to int
  • Convert double to string
  • Convert double to float
  • Convert double to int
  • Convert double to long
  • Convert char to int
  • Convert boolean to string
  • Create a file
  • Read file as string
  • Write string to file
  • Delete File
  • Rename File
  • Download File from URL
  • Replace a String in File
  • Filter list of files or directories
  • Check if file is readable
  • Check if file is writable
  • Check if file is executable
  • Read contents of a file line by line using BufferedReader
  • Read contents of a File line by line using Stream
  • Check if n is positive or negative
  • Read integer from console
  • Add two integers
  • Count digits in number
  • Largest of three numbers
  • Smallest of three numbers
  • Even numbers
  • Odd numbers
  • Reverse a number
  • Prime Number
  • Print All Prime Numbers
  • Factors of a Number
  • Check Palindrome number
  • Check Palindrome string
  • Swap two numbers
  • Even or Odd number
  • Java Classes
  • ArrayList add()
  • ArrayList addAll()
  • ArrayList clear()
  • ArrayList clone()
  • ArrayList contains()
  • ArrayList ensureCapacity()
  • ArrayList forEach()
  • ArrayList get()
  • ArrayList indexOf()
  • ArrayList isEmpty()
  • ArrayList iterator()
  • ArrayList lastIndexOf()
  • ArrayList listIterator()
  • ArrayList remove()
  • ArrayList removeAll()
  • ArrayList removeIf()
  • ArrayList removeRange()
  • ArrayList retainAll()
  • ArrayList set()
  • ArrayList size()
  • ArrayList spliterator()
  • ArrayList subList()
  • ArrayList toArray()
  • ArrayList trimToSize()
  • HashMap clear()
  • HashMap clone()
  • HashMap compute()
  • HashMap computeIfAbsent()
  • HashMap computeIfPresent()
  • HashMap containsKey()
  • HashMap containsValue()
  • HashMap entrySet()
  • HashMap get()
  • HashMap isEmpty()
  • HashMap keySet()
  • HashMap merge()
  • HashMap put()
  • HashMap putAll()
  • HashMap remove()
  • HashMap size()
  • HashMap values()
  • HashSet add()
  • HashSet clear()
  • HashSet clone()
  • HashSet contains()
  • HashSet isEmpty()
  • HashSet iterator()
  • HashSet remove()
  • HashSet size()
  • HashSet spliterator()
  • Integer bitCount()
  • Integer byteValue()
  • Integer compare()
  • Integer compareTo()
  • Integer compareUnsigned()
  • Integer decode()
  • Integer divideUnsigned()
  • Integer doubleValue()
  • Integer equals()
  • Integer floatValue()
  • Integer getInteger()
  • Integer hashCode()
  • Integer highestOneBit()
  • Integer intValue()
  • Integer longValue()
  • Integer lowestOneBit()
  • Integer max()
  • Integer min()
  • Integer numberOfLeadingZeros()
  • Integer numberOfTrailingZeros()
  • Integer parseInt()
  • Integer parseUnsignedInt()
  • Integer remainderUnsigned()
  • Integer reverse()
  • Integer reverseBytes()
  • Integer rotateLeft()
  • Integer rotateRight()
  • Integer shortValue()
  • Integer signum()
  • Integer sum()
  • Integer toBinaryString()
  • Integer toHexString()
  • Integer toOctalString()
  • Integer toString()
  • Integer toUnsignedLong()
  • Integer toUnsignedString()
  • Integer valueOf()
  • StringBuilder append()
  • StringBuilder appendCodePoint()
  • StringBuilder capacity()
  • StringBuilder charAt()
  • StringBuilder chars()
  • StringBuilder codePointAt()
  • StringBuilder codePointBefore()
  • StringBuilder codePointCount()
  • StringBuilder codePoints()
  • StringBuilder delete()
  • StringBuilder deleteCharAt()
  • StringBuilder ensureCapacity()
  • StringBuilder getChars()
  • StringBuilder indexOf()
  • StringBuilder insert()
  • StringBuilder lastIndexOf()
  • StringBuilder length()
  • StringBuilder offsetByCodePoints()
  • StringBuilder replace()
  • StringBuilder reverse()
  • StringBuilder setCharAt()
  • StringBuilder setLength()
  • StringBuilder subSequence()
  • StringBuilder substring()
  • StringBuilder toString()
  • StringBuilder trimToSize()
  • Arrays.asList()
  • Arrays.binarySearch()
  • Arrays.copyOf()
  • Arrays.copyOfRange()
  • Arrays.deepEquals()
  • Arrays.deepToString()
  • Arrays.equals()
  • Arrays.fill()
  • Arrays.hashCode()
  • Arrays.sort()
  • Arrays.toString()
  • Random doubles()
  • Random ints()
  • Random longs()
  • Random next()
  • Random nextBoolean()
  • Random nextBytes()
  • Random nextDouble()
  • Random nextFloat()
  • Random nextGaussian()
  • Random nextInt()
  • Random nextLong()
  • Random setSeed()
  • Math random
  • Math signum
  • Math toDegrees
  • Math toRadians
  • Java Date & Time
  • ❯ Java Tutorial

Java Bitwise AND Assignment (&=) Operator

Java bitwise and assignment.

In Java, Bitwise AND Assignment Operator is used to compute the Bitwise AND operation of left and right operands, and assign the result back to left operand. In this tutorial, we will learn how to use Bitwise AND Assignment operator in Java, with examples.

The syntax to compute bitwise AND a value of 2 and value in variable x , and assign the result back to x using Bitwise AND Assignment Operator is

In the following example, we take a variable x with an initial value of 9 , add bitwise AND it with value of 2 , and assign the result to x , using Bitwise AND Assignment Operator.

In this Java Tutorial , we learned about Bitwise AND Assignment Operator in Java, with examples.

Popular Courses by TutorialKart

App developement, web development, online tools.

Javatpoint Logo

Java Tutorial

Control statements, java object class, java inheritance, java polymorphism, java abstraction, java encapsulation, java oops misc.

JavaTpoint

Using Compound Assignment Operator in a Java Program

CompoundAssignmentOperator.java

Youtube

  • Send your Feedback to [email protected]

Help Others, Please Share

facebook

Learn Latest Tutorials

Splunk tutorial

Transact-SQL

Tumblr tutorial

Reinforcement Learning

R Programming tutorial

R Programming

RxJS tutorial

React Native

Python Design Patterns

Python Design Patterns

Python Pillow tutorial

Python Pillow

Python Turtle tutorial

Python Turtle

Keras tutorial

Preparation

Aptitude

Verbal Ability

Interview Questions

Interview Questions

Company Interview Questions

Company Questions

Trending Technologies

Artificial Intelligence

Artificial Intelligence

AWS Tutorial

Cloud Computing

Hadoop tutorial

Data Science

Angular 7 Tutorial

Machine Learning

DevOps Tutorial

B.Tech / MCA

DBMS tutorial

Data Structures

DAA tutorial

Operating System

Computer Network tutorial

Computer Network

Compiler Design tutorial

Compiler Design

Computer Organization and Architecture

Computer Organization

Discrete Mathematics Tutorial

Discrete Mathematics

Ethical Hacking

Ethical Hacking

Computer Graphics Tutorial

Computer Graphics

Software Engineering

Software Engineering

html tutorial

Web Technology

Cyber Security tutorial

Cyber Security

Automata Tutorial

C Programming

C++ tutorial

Control System

Data Mining Tutorial

Data Mining

Data Warehouse Tutorial

Data Warehouse

RSS Feed

On the red sand next to a river, several wolves of different variants are hanging out. Two of the wolves are wearing armor. An armadillo is rolled up in the foreground and another armadillo is standing to the right with its baby. In the background, a jungle can be seen.

Minecraft Java Edition 1.20.5

The Armored Paws Drop Now Out for Java

Do you smell that? Ah yes, it's the magical, tell-tale scent of release day Tuesday - and what a release day it is!

Today we are shipping Minecraft: Java Edition 1.20.5, also known as the Armored Paws drop! Travel to the Savanna and Badlands biomes and say hello to the endearing Armadillos. Find and befriend eight new Wolf variants and equip your canine companions with dyable armor made from Armadillo Scutes and go adventuring together!

On the technical side, the Armored Paws drop is also introducing a change to how Java Edition spawn chunks work, the details of which we covered in the changelog for Snapshot 24w03a earlier this year. The tl;dr version of this change is that we're making the spawn chunk radius a configurable game rule and decreasing the default value by 98%. This should translate to a noticeable performance boost for most players!

So what are you waiting for? Stock up on food and water and start reading through the complete 1.20.5 changelog below. It's a looong one.

Happy scute brushing!

New Features

  • Added Armadillo and Armadillo Scutes
  • Added Wolf Armor
  • Added Wolf variants
  • The Armadillo is a new passive mob
  • Armadillos drop Armadillo Scutes periodically, and when brushed
  • Armadillos spawn in Savannas and Badlands
  • Armadillos are tempted by Spider Eyes
  • Feeding two adult Armadillos Spider Eyes makes them breed
  • Feeding a baby Armadillo a Spider Eye makes it grow up quicker
  • A player sprinting, riding a mount, or riding a vehicle
  • Undead mobs
  • A mob or a player it has recently been attacked by
  • Fleeing, in water, in the air, or when on a Lead
  • It does not walk, cannot eat, and will not be tempted by food
  • Its shell will protect it, reducing damage taken, even allowing it to fully resist weak attacks
  • If no threats are detected for 4 seconds, it will unroll
  • Spiders and Cave Spiders will run away from Armadillos that are not in a rolled up state

Armadillo Scutes

  • Armadillo Scutes are dropped by Armadillos periodically or when an Armadillo is brushed
  • Armadillo Scutes can be used to craft Wolf Armor
  • Dispensers can be used to brush Armadillo Scutes off Armadillos
  • Wolf Armor can be crafted with Armadillo Scutes and can be dyed in a similar fashion to Leather Armor
  • The Wolf Armor will protect the Wolf from most damage sources until the armor loses all durability and breaks
  • Wolf Armor shows signs of breakage as durability goes down
  • Using Armadillo Scutes on the Wolf Armor while it is equipped on the Wolf will repair it
  • Using Shears on a Wolf that is wearing armor will drop the armor
  • Wolf Armor can only be equipped on a tame adult Wolf
  • Only the Wolf's owner can equip, repair, and shear Wolf Armor
  • Dispensers cannot equip nor remove Wolf Armor

Wolf Variants

New Wolf variants have been added. The variant is determined by the biome they spawn in. Wolves spawn in packs, with a default pack size of 4.

  • Pale Wolf - The Wolf we're all familiar with. This variant spawns in the Taiga biome
  • Woods Wolf - A variant that spawns in the Forest biome. This will be the dominant Wolf variant that you will be able to find in the Overworld, since the Forest biome is very common
  • Ashen Wolf - A variant that spawns in the Snowy Taiga biome
  • Black Wolf - A variant that spawns in the Old Growth Pine Taiga biome, in smaller packs of 2-4
  • Chestnut Wolf - A variant that spawns in the Old Growth Spruce Taiga biome, in smaller packs of 2-4
  • Rusty Wolf - A variant that spawns in a new location for Wolves - the Sparse Jungle biome, in smaller packs of 2-4
  • Spotted Wolf - A variant that spawns in a new location for Wolves - the Savanna Plateau biome, in larger packs of 4-8
  • Striped Wolf - A variant that spawns in a new location for Wolves - the Wooded Badlands biome, in larger packs of 4-8
  • Snowy Wolf - A variant that spawns in the Grove biome. This lone Wolf is a rare type, as it always walks alone

When summoned in other ways (e.g. using the Spawn Egg or using the summon command), the variant selection follows the natural spawning biome rules with the following extensions:

  • Rusty Wolf: will be selected in all Jungle-like biomes, including Jungle and Bamboo Jungle Biomes
  • Spotted Wolf: will be selected in all Savanna-like biomes, including Savanna and Windswept Savanna Biomes
  • Striped Wolf: will be selected in all Badlands-like biomes, including Badlands and Eroded Badlands Biomes

Advancements

  • Isn't It Scute? - Get Armadillo Scutes from an Armadillo using a Brush
  • Shear Brilliance - Remove Wolf Armor from a Wolf using Shears
  • Good as New - Repair a damaged Wolf Armor using Armadillo Scutes
  • The Whole Pack - Tame one of each Wolf variant

A family of Armadillos walking on the Red Sand of the Badlands amidst Dead Bushes with a green Jungle in the background.

A family of Armadillos walking on the Red Sand of the Badlands. Click here for a link to the full-size image.

A rolled-up Armadillo is peeking to check if a Zombie is gone, but the Zombie is still close. It happens in Savanna during twilight.

A rolled-up Armadillo is peeking to check if a Zombie is gone. Click here for a link to the full-size image.

Ari is fighting two Skeletons and a Creeper in a partially lit cave with their Tamed Wolves who are wearing colorful Wolf Armor sets.

Ari is fighting together with their Tamed Wolves who are wearing colorful Wolf Armor sets. Click here for a link to the full-size image.

Efe is trying to tame a striped Wolf on a Savanna Plateau. In the background a river is flowing through a Badlands Canyon.

Efe is trying to tame a striped Wolf on a Savanna Plateau. Click here for a link to the full-size image.

Ari is jumping over a ravine in a Savanna on a brown Horse with white spots. A big pack Tamed Wolves of different variants is following them.

Ari is jumping over a ravine with a big pack Tamed Wolves of different variants is following them. Click here for a link to the full-size image.

Steve is experimenting with different potion effects in a Savanna Village hut. Potion effect particles of different colors are visible around them.

Steve is experimenting with different potion effects with particles of different colors are visible around them. Click here for a link to the full-size image.

An updated Minecraft options screen with a new transparent background. The game world is blurred but visible behind the menu elements. A grey sheep is looking at the player.

The updated Minecraft options screen with a new transparent background. Click here for a link to the full-size image.

  • The UI has been updated with a fresher look
  • Decreased the default size of the spawn chunks and made the value configurable
  • Updated the health and damage dealt by Tamed Wolves
  • Adjusted spawning conditions for Wolves, allowing them to spawn on Coarse Dirt and Podzol blocks
  • Adjusted the texture of the Wolf Collar layer to be more consistent with the new Wolf Armor
  • Adjusted passive mobs spawning in Grove biome to only include Rabbits, Foxes and Wolves
  • Minor tweaks to existing Blocks, Items and Entities
  • Added option to use Japanese variants of CJK characters
  • Added support for Viossa language
  • When entities leave or enter The End, the area they arrive in will now stay loaded for 15 seconds, matching the behavior of Nether Portals
  • Improvements to the Game's Performance
  • Improved handling of errors during saving and loading

The UI has been updated to sport a fresher look and to be more consistent when it comes to the layout of different UI elements, all while retaining the essence and feel of the old screens.

  • The dirt background can be restored by using the built-in Programmer Art Resource Pack
  • Outside the game, the main menu panorama is displayed behind all screens
  • In the game, the world will be visible behind all screens
  • The strength of the blur can be configured in Video Settings and Accessibility Settings
  • In-game screens such as containers and books are not affected by these changes
  • Screen elements such as titles and buttons are positioned more consistently across different screens
  • The World Backups screen and the Players screen in the Realms menu have been updated
  • Lists now have clearer borders at the top and bottom
  • Button tooltips will no longer appear when hovering outside the containing element
  • After defeating the Ender Dragon and entering the End Portal, the End Poem and credits are now displayed with a background based on the animated End Portal effect
  • The animated Nether Portal texture is displayed when changing dimension to or from The Nether
  • The animated End Portal effect is displayed when changing dimension to or from The End

Spawn Chunk Changes

  • This was done to reduce loading times, as well as memory and CPU usage
  • We opted to not fully remove spawn chunks to allow players who currently utilize this functionality to continue to do so
  • Possible values are 0 to 32, where 0 completely disables the spawn chunks and 10 is equivalent to the functionality before this change
  • Default value is 2, equivalent to 3x3 entity ticking chunks
  • Note that setting this to a high value might require allocating more memory for the game in the Launcher

Tamed Wolves Health and Damage

  • Tamed Wolves now have 40 health points (20 hearts) instead of 20 health points (10 hearts)
  • In most cases, this change will make no difference given the health boost, but they can now withstand more damage from players and arrows
  • Feeding a Wolf now heals twice as many health points

Minor Tweaks to Blocks, Items and Entities

  • Renamed scutes that drop from Turtles to Turtle Scutes
  • Added unique sounds for Cobwebs
  • Enchantments on Items are now always listed in the same order in tooltips, regardless of how they were added to those items
  • Adjusted flying behaviour for Bees and Parrot to keep them from overshooting their position when flying up and down
  • Llamas and Shulkers are no longer able to destroy Armor Stands
  • All active visible status effect particles are now rendered separately
  • Ctrl+Picking a renamed block (such as a Chest) in Creative Mode will now give a renamed item
  • Ctrl+Picking a block no longer lists "(+NBT)" in the item tooltip

Accessibility

  • The default focus is now always set when entering or exiting any menu while navigating using tab or arrow keys
  • Added a new accessibility option to control the strength of the background blur when a menu is open

Japanese Font Variants

  • A new option has been added to select Japanese variants for some CJK characters
  • Replacement glyphs come from the Japanese version of the Unifont font
  • The new option is included in a new "Font Settings" menu, accessible from the "Language" menu
  • The default value of this option is based on the system locale language setting
  • The "Force Unicode" button has been moved to "Font Settings"

Performance Improvements

  • Improved Hopper performance
  • Beehives and Bee Nests are exempt from this
  • This does not affect Minecarts with Hoppers
  • Reduced time needed to generate Explorer Maps to Buried Treasures

Saving and Loading Improvements

  • In Singleplayer, when errors occur during loading or saving of chunks, a warning will be shown in a toast
  • Additionally, a warning toast will be shown periodically while in game

In the Crafting interface, a "Stiiiiiick" has been crafted with 3 Sticks in the grid using a custom data pack. The item tooltip shows the text "Like a stick, but stickier".

In the Crafting interface, a "Stiiiiiick" has been crafted with 3 Sticks in the grid using a custom data pack. Click here for a link to the full-size image.

A player is eating a Stick by using an attached food component.

A player is eating a customized Stick by using an attached food component. Click here for a link to the full-size image.

A tiny Camel is looking at a very large Bee that flies towards the camera. In the background a giant Chicken is falling right above a regularly-sized Sheep.

Various mobs have been resized making use of the scale attribute. Click here for a link to the full-size image.

A tiny Kai, roughly 2 pixels tall, is standing next to a Birch Button and staring up towards a normal (but relatively giant) Milk Bucket item.

A tiny Kai, scaled down with the scale attribute. Click here for a link to the full-size image.

A very large Sunny is walking up 3-block-tall steps in a Cherry Grove biome, making use of the step height and scale attributes.

A very large Sunny is walking up 3-block-tall steps in a Cherry Grove biome, making use of the step height and scale attributes. Click here for a link to the full-size image.

Technical Changes

  • The Data Pack version is now 41
  • The Resource Pack version is now 32
  • The game now requires Java 21
  • The game now requires a 64-bit Operating System
  • The included Java distribution is now the Microsoft build of OpenJDK 21.0.3
  • Added transfer and cookie packets for custom servers
  • Added an option to use a faster region file compression algorithm on dedicated servers
  • Added a reserved region file compression id for third-party servers to use for custom compression implementations
  • Changes to optimizing worlds
  • Improved server TPS debug chart
  • Allowed server operators to view dedicated server TPS debug chart
  • Added JFR (Java Flight Recorder) events for individual chunk reads ( minecraft.ChunkRegionRead ) and writes ( minecraft.ChunkRegionWrite )

Network Protocol

  • Reduced amount of data sent by the server during login by reusing parts of the vanilla data pack
  • Client chat state is now preserved by default when entering configuration phase
  • To ease the transition period, modded servers can opt out by setting the appropriate field in the handshake/game_profile packet
  • This option will be removed in the next release
  • Commands that do not accept any signed arguments will use the unsigned packet, and will not pass any 'last seen' chat updates

Transfer Packets

  • Custom servers can now request that clients connect to another server with a new packet
  • When a client is transferred, it will connect to the target server with a new transfer intent (id 3)
  • By default, servers will not accept incoming transfers and will disconnect the client
  • This can be changed by setting the accepts-transfers property to true in the server.properties file
  • Resource packs are maintained across transfers
  • In the case of a transfer, custom servers can skip authenticating again with a new flag in the clientbound hello packet

Cookie Packets

  • Each cookie may be up to 5 KiB in size
  • Cookies may be requested during login, configuration and play phases — but only stored during the configuration and play phases
  • This allows servers to pass along information such as authentication or custom game data to the new server

Region File Compression Algorithm

  • deflate , the default option. Uses the old algorithm
  • lz4 uses LZ4 algorithm, which requires less CPU time to compress and decompress but uses more disk space
  • This consumes significantly more space and requires significant time to read and write, even though CPU is used less
  • Might make sense together with filesystem level compression
  • New or updated chunks will use the newly configured algorithm, but the old ones will stay in the previous format

Reserved Compression Id for Third-party Servers

  • Compression id 127 can now be used for custom implementations of region file compression
  • When used, the version id must be followed by a namespaced string representing the custom algorithm used

World Optimizing Changes

  • Optimizing singleplayer worlds and running a dedicated server with the forceUpgrade option now also upgrades contentsof entities and poi directories of the world
  • It will trigger world optimization similar to forceUpgrade , but will also rewrite all the chunks independentlyof whether they have been upgraded
  • This will create fresh and defragmented region files
  • Using this parameter after changing the region-file-compression server property will recompress all region filesin the new format

A screenshot of the updated ticks-per-second graph.

Improved The Server TPS Debug Chart

  • As before, it is accessible by pressing F3 + 2
  • This is equivalent to the value displayed in the old chart
  • The light brown section displays time spent running scheduled tasks
  • The purple section displays time spent executing all other code during the tick
  • The top light green (or yellow or red depending on lag) section displays time spent idling, waiting for next tick
  • The min , avg , max aggregate values are based on the sum of the first 3 sections
  • Server operators can now view the TPS debug chart while connected to their dedicated server
  • Client chat state (on-screen messages and chat input history) is now preserved by client when entering and exiting configuration phase
  • Message signature chain handling remains unchanged - going into configuration phase starts a new session
  • If the client has a message delay configured, any pending messages will be delivered immediately before leaving the world
  • The server can clear chat state by sending a reset_chat packet in configuration phase

Data Pack Versions 27 through 41

The Data Pack version used by the game is now 41. These are the changes compared to version 26, used in 1.20.4.

  • Renamed scute item to turtle_scute
  • Changed Item Stack data format, introducing Item Stack Components
  • Added many new Attributes
  • Added new loot functions
  • Added new advancement predicates
  • Added new tags
  • Recipe results can now specify component data
  • Added data-driven registries for Banner Patterns and Wolf Variants
  • Particle representation in commands and area effect clouds has been changed

Item Data Format

We have made some large changes to how Item Stack-specific properties are stored and represented in this release, replacing the current NBT 'tag' with structured 'components'.

This change has been made in order to:

  • This should avoid any 'silent' breakages in commands specifying custom item data for any potential future format changes
  • Continue to evolve the game to enable the creation of dynamic content
  • Improve performance in cases where the game needs to frequently look up some property of an item (e.g. Armor Trims rendering every frame)
  • We understand that this is a significant breaking change for many datapacks and custom maps which will require significant effort to upgrade

We do however believe that this builds critical foundations for future extensibility. We have taken care to ship these changes all at once, with the hope that this avoids future incremental changes requiring many small updates to packs.

The current NBT 'tag' has existed for quite some time, and we are aware that a lot of clever techniques have been developed with this for commands and data packs. Over the course of the snapshot series, we have hugely appreciated your feedback on these changes, allowing us to avoid (often undocumented) functionality being lost without suitable alternatives.

  • This data is parsed and validated when the item is loaded
  • This should improve performance in certain scenarios (e.g. Armor Trim rendering) when item data was frequently compared or requested and parsed
  • Custom data can still be stored in the minecraft:custom_data component
  • Item types (e.g. minecraft:stick ) hold a set of default components on an item that individual item stacks can override
  • The format of serialized items and items in data packs has been updated for consistency and to support components
  • Item syntax in commands has been updated to support components
  • When advanced tooltips are enabled (F3+H), the number of components will be displayed instead of number of tags
  • Default component values for items are now listed in items.json generated in reports directory
  • Block definitions are now added to blocks.json report (note: those definitions are not used yet and present only for informational purposes)

Migrated Item Stack Components

These are item stack components that replace existing functionality that was formerly specified in item NBT.All commands and data definitions will need to be upgraded to use these formats. Items in-world will however be automatically upgraded.

minecraft:custom_data

  • Can be used for custom data storage on an item
  • When upgrading a world, any non-game data in the item tag will be moved into here
  • e.g. custom_data={some:'data'}
  • Can be modified with the set_custom_data and copy_custom_data loot functions

minecraft:damage

  • The amount of durability removed from an item
  • If removed, the item will not be damageable
  • Replaces Damage tag
  • e.g. damage=12
  • For damageable items (with the max_damage component), has an implicit default value of: 0
  • Can be modified with the set_damage loot function

minecraft:repair_cost

  • The additional experience cost required to modify an item in an Anvil
  • Replaces RepairCost tag
  • e.g. repair_cost=12
  • If not set, has an implicit default value of: 0

minecraft:unbreakable

  • If set, the item will not lose any durability when used
  • Replaces Unbreakable boolean tag
  • If true , an 'Unbreakable' line will be included in the tooltip
  • Replaces 3rd bit of HideFlags tag
  • e.g. unbreakable={} , unbreakable={show_in_tooltip:false}

minecraft:enchantments

  • Stores a list of enchantments and their levels on an item
  • Replaces Enchantments tag
  • levels : object of enchantment (id string) to level (integer [0; 255])
  • If false , no enchantments will be shown in the item tooltip
  • Replaces 1st bit of HideFlags tag
  • e.g. enchantments={levels:{'minecraft:protection':2},show_in_tooltip:false}
  • e.g. enchantments={sharpness:1}
  • If not set, has an implicit default value of: {levels:{}}
  • Can be modified with the set_enchantments , enchant_randomly , and enchant_with_levels loot functions

minecraft:stored_enchantments

  • Stores list of enchantments and their levels for an Enchanted Book
  • Unlike minecraft:enchantments , the effects provided by enchantments do not apply from this component
  • Replaces StoredEnchantments tag on Enchanted Books
  • show_in_tooltip value replaces 6th bit of HideFlags tag
  • On Enchanted Books, has an implicit default value of: {levels:{}}

minecraft:custom_name

  • Custom name override for an item (as set by renaming with an Anvil)
  • Replaces display.Name tag
  • e.g. custom_name='{"text": "This item is renamed!", "color": "red"}'
  • Can be modified with the set_name loot function

minecraft:lore

  • Additional lines to include in an item's tooltip
  • Replaces display.Lore tag
  • e.g. lore=['{"text": "The cake is a lie!"}']
  • If not set, has an implicit default value of: []
  • Can be modified with the set_lore loot function

minecraft:can_break

  • Controls which blocks a player in Adventure mode can break with this item
  • These were previously stored as flat strings, but now use the more flexible block predicate format already used in loot tables and advancements
  • blocks : block, list of blocks, or hash-prefixed block tag
  • nbt : block entity NBT to match
  • state : map of state property key to values to match
  • Replaces 4th bit of HideFlags tag
  • e.g. can_break={predicates:[{blocks:'minecraft:furnace',state:{facing:'north'}]}
  • e.g. can_break={blocks:'minecraft:stone'}

minecraft:can_place_on

  • Controls which blocks a player in Adventure mode can place on with this item
  • Replaces CanPlaceOn tag
  • Same as can_break.predicates
  • Replaces 5th bit of HideFlags tag
  • e.g. can_place_on={predicates:[{blocks:'minecraft:furnace',state:{facing:'north'}]}
  • e.g. can_place_on={blocks:'minecraft:stone'}

minecraft:dyed_color

  • Represents a color applied to a dyeable item (in the #minecraft:dyeable item tag)
  • Replaces display.color tag
  • rgb : integer, RGB value
  • Replaces 7th bit of HideFlags tag
  • e.g. dyed_color={rgb:16711680}
  • e.g. dyed_color=16711680

minecraft:attribute_modifiers

  • Holds attribute modifiers applied to any item
  • Replaces AttributeModifiers tag
  • Replaces AttributeName
  • any (default)
  • hand : either in main or offhand (new)
  • armor : any armor slot (new)
  • Modifiers will only apply when the item is equipped in the specified slot
  • Replaces Slot
  • Only one modifier can exist with the same id
  • Replaces UUID
  • Replaces Name
  • Replaces Amount
  • add_value (was 0 ): Adds amount to the attribute
  • add_multiplied_base (was 1 ): Adds amount * base value to the attribute
  • add_multiplied_total (was 2 ): Adds amount * total value (from all previous modifiers) to the attribute
  • Replaces Operation with integer ids
  • Replaces 2nd bit of HideFlags tag
  • e.g. attribute_modifiers={modifiers:[{type:'minecraft:generic.scale',uuid:[1,2,3,4],name:'Big!',amount:1.0,operation:'add_multiplied_base'}]}
  • e.g. attribute_modifiers=[{type:'generic.scale',uuid:[1,2,3,4],name:'Big!',amount:1.0,operation:'add_multiplied_base'}]
  • If not set, has an implicit default value based on the item type's default attributes (e.g. attack damage for weapons)
  • Can be modified with the set_attributes loot function

minecraft:charged_projectiles

  • Holds all projectiles that have been loaded into a Crossbow
  • If not present, the Crossbow is not charged
  • Replaces Charged and ChargedProjectiles tags
  • Cannot store empty/air items
  • e.g. charged_projectiles=[{id:'minecraft:arrow'}]
  • No longer restricted to 3 entries
  • Can be modified with the modify_contents and set_contents loot functions

minecraft:intangible_projectile

  • Marks that a projectile item would be intangible when fired (i.e. can only be picked up by a creative mode player)
  • Only set when items are inside a Crossbow's charged_projectiles component
  • e.g. intangible_projectile={}

minecraft:bundle_contents

  • Holds all items stored inside of a Bundle
  • If removed, items cannot be added to the Bundle
  • Replaces Items tag
  • e.g. bundle_contents=[{id:'minecraft:poisonous_potato'}]
  • On Bundles, has an implicit default value of: []

minecraft:map_color

  • Represents the tint of the decorations on the Filled Map item
  • Replaces display.MapColor tag
  • e.g. map_color=16711680
  • On Filled Maps, has an implicit default value of: 4603950

minecraft:map_decorations

  • Holds a list of markers to be placed on a Filled Map (used for Explorer Maps)
  • Replaces Decorations tag
  • player (was 0 )
  • frame (was 1 )
  • red_marker (was 2 )
  • blue_marker (was 3 )
  • target_x (was 4 )
  • target_point (was 5 )
  • player_off_map (was 6 )
  • player_off_limits (was 7 )
  • mansion (was 8 )
  • monument (was 9 )
  • banner_white (was 10 )
  • banner_orange (was 11 )
  • banner_magenta (was 12 )
  • banner_light_blue (was 13 )
  • banner_yellow (was 14 )
  • banner_lime (was 15 )
  • banner_pink (was 16 )
  • banner_gray (was 17 )
  • banner_light_gray (was 18 )
  • banner_cyan (was 19 )
  • banner_purple (was 20 )
  • banner_blue (was 21 )
  • banner_brown (was 22 )
  • banner_green (was 23 )
  • banner_red (was 24 )
  • banner_black (was 25 )
  • red_x (was 26 )
  • village_desert (was 27 )
  • village_plains (was 28 )
  • village_savanna (was 29 )
  • village_snowy (was 30 )
  • village_taiga (was 31 )
  • jungle_temple (was 32 )
  • swamp_hut (was 33 )
  • trial_chambers (new)
  • Replaces type byte with numeric ids
  • x : double, world coordinate
  • z : double, world coordinate
  • Replaces rot double
  • e.g. map_decorations={'Some marker':{type:'target_x',x:123.0,z:-45.0,rotation:0.0f}}
  • On Filled Maps, has an implicit default value of: {}

minecraft:map_id

  • References the shared map state holding map contents and markers for a Filled Map
  • Replaces map tag
  • e.g. map_id=1

minecraft:custom_model_data

  • Can be used to replace the models of items by selecting for the minecraft:custom_model_data property in the item model
  • Replaces CustomModelData tag
  • e.g. custom_model_data=43
  • Can be modified with the set_custom_model_data loot function

minecraft:potion_contents

  • Holds the contents of a potion (Potion, Splash Potion, Lingering Potion), or potion applied to an item (Tipped Arrow)
  • Replaces Potion , CustomPotionColor , and custom_potion_effects tags
  • The potion type in this item: the item will inherit all effects from this
  • Overrides the visual color of the potion
  • Additional list of custom effects that this item should apply, that may not be representable by an existing potion
  • e.g. potion_contents={potion:'minecraft:invisibility',custom_color:16711680}
  • e.g. potion_contents="invisibility"
  • On Potion or Tipped Arrow items, has an implicit default value of: {}
  • Can be modified with the set_potion loot function

minecraft:writable_book_content

  • Holds the contents in a Book and Quill
  • The pages list objects directly, with {raw:'...'} wrapping
  • filtered_pages are pulled by index keys into the relevant page entry under the filtered field
  • raw : string, page plain text contents
  • If specified, players with chat filter enabled will see this page instead of raw
  • or: string, page plain text contents
  • e.g. writable_book_content={pages:['Hello world!']} or writable_book_content={pages:[{raw:'Hello world!'}]}
  • On Book and Quill, has an implicit default value of: {pages:[]}
  • Can be modified with the set_writable_book_pages loot function

minecraft:written_book_content

  • Holds the contents and metadata of a Written Book
  • Replaces pages , filtered_pages , title , filtered_title , author , generation , and resolved tags
  • Same format as writable_book_contents pages, except uses JSON chat component strings which can be formatted
  • title : filtered string (same format as pages)
  • author : string, player name
  • The number of times this book has been copied ( 0 = original)
  • true if the chat components in this book have already been resolved (entity selectors, scores substituted)
  • If false , it will be resolved when opened by a player
  • e.g. written_book_content={pages:['"Hello world!"'],title:{raw:'"A delightful read"'},author:'Herobrine',generation:1,resolved:true}
  • Can be modified with the set_written_book_pages and set_book_cover loot functions

minecraft:trim

  • Presence of the component is no longer restricted by the #minecraft:trimmable_armor item tag (although, this tag is still used for recipes)
  • Replaces Trim tag of the same format
  • pattern : pattern id (or inline pattern)
  • material : material id (or inline material)
  • Replaces 8th bit of HideFlags tag
  • e.g. trim={pattern:'minecraft:silence',material:'minecraft:redstone'}

minecraft:suspicious_stew

  • Holds the effects that will be applied when consuming Suspicious Stew
  • Replaces effects tag of the same format
  • id : effect id
  • duration : integer, tick count (default: 160 )
  • e.g. suspicious_stew=[{id:'minecraft:poison'}]
  • On Suspicious Stew, has an implicit default value of: []
  • Can be modified with the set_stew_effect loot function

minecraft:hide_additional_tooltip

  • If present, disables 'additional' tooltip part which comes from the item type
  • Replaces 6th bit of HideFlags tag
  • e.g. hide_additional_tooltip={}

minecraft:debug_stick_state

  • Stores the selected block state properties used by a Debug Stick
  • Replaces DebugProperty tag
  • e.g. debug_stick_state={'minecraft:turtle_egg':'eggs','minecraft:furnace':'facing'}
  • On Debug Stick, has an implicit default value of: {}

minecraft:entity_data

  • Stores unstructured NBT data to apply to an entity when using an item that spawns an entity, such as a Spawn Egg or Armor Stand
  • Replaces previous EntityTag tag, with same behavior
  • Must contain an id field with the entity type
  • Any additional fields will be merged into the entity when spawned
  • e.g. entity_data={id:'minecraft:pig',Health:1.0f}

minecraft:bucket_entity_data

  • Stores unstructured NBT data to apply to an entity when placed from a bucket
  • Replaces NoAI , Silent , NoGravity , Glowing , Invulnerable , Health , Age , Variant , HuntingCooldown , and BucketVariantTag tags
  • Can contain any of the above listed fields, which will be applied to the entity when placed
  • e.g. bucket_entity_data={NoAI:1,Age:43}
  • On bucketed mob items, has an implicit default value of: {}

minecraft:instrument

  • Holds the instrument type used by a Goat Horn
  • Replaces instrument tag of same format
  • e.g. instrument='minecraft:ponder_goat_horn'
  • Can be modified with the set_instrument loot function

minecraft:recipes

  • List of recipes that should be unlocked when using the Knowledge Book item
  • Replaces Recipes tag of same format
  • e.g. recipes=['minecraft:acacia_boat','minecraft:anvil']
  • On Knowledge Book, has an implicit default value of: []

minecraft:lodestone_tracker

  • If present, specifies that the Compass is a Lodestone Compass
  • Replaces LodestonePos , LodestoneDimension , and LodestoneTracked tags
  • pos : integer array of x, y, and z
  • dimension : dimension id
  • If not present, the compass will spin
  • If true , when the Lodestone at the target position is removed, the target field will be removed
  • e.g. lodestone_tracker={target:{pos:[13,64,-43],dimension:'minecraft:the_nether'}}

minecraft:firework_explosion

  • Stores the explosion crafted in a Firework Star
  • Replaces Explosion.Type , Explosion.Colors , Explosion.FadeColors , Explosion.Trail , and Explosion.Flicker tags
  • small_ball (was 0 )
  • large_ball (was 1 )
  • star (was 2 )
  • creeper (was 3 )
  • burst (was 4 )
  • Replaces Type numeric ids
  • List of initial particle colors, randomly selected from
  • List of particle colors to fade to, randomly selected from
  • has_trail : boolean (default: false )
  • Renamed from Flicker tag
  • e.g. firework_explosion={shape:'large_ball',colors:[16711680],has_trail:true}
  • Can be modified with the set_firework_explosion loot function

minecraft:fireworks

  • Stores all explosions crafted into a Firework Rocket, as well as flight duration
  • Replaces Fireworks.Explosions and Fireworks.Flight tags
  • Same format as minecraft:firework_explosion component
  • flight_duration : unsigned byte, number of gunpowder in this rocket
  • e.g. fireworks={explosions:[{shape:'large_ball',colors:[16711680],has_trail:true}],flight_duration:2}
  • On Firework Rocket, has an implicit default value of: {explosions:[],flight_duration:1}
  • Can be modified with the set_fireworks loot function

minecraft:profile

  • Controls the skin displayed on a Player Head
  • Copied to Player Head block when placed
  • Replaces SkullOwner tag
  • If only a name is specified, it will be resolved into the corresponding player ID and skin data
  • Unlike SkullOwner which only supported resolution by name, if only id is specified, the profile and skin will be resolved from this UUID
  • Must be a valid player name (max 16 characters, no spaces, or special characters)
  • As this could exist in previous data formats, but would not resolve to a skin, this is replaced by the item_name component which is persisted when placed and broken
  • id : uuid, player profile id (optional)
  • name : string, property name (e.g. textures )
  • value : string (base64 encoded texture data)
  • signature : string (optional)
  • e.g. profile={name:'MHF_Sheep'}
  • e.g. profile='MHF_Sheep'
  • Can be modified with the fill_player_head loot function

minecraft:note_block_sound

  • Controls the sound played by a Player Head when placed on a Note Block
  • Replaces BlockEntityTag.note_block_sound tag
  • e.g. note_block_sound='minecraft:ambient.cave'

minecraft:base_color

  • Stores the base color for a Shield
  • Replaces BlockEntityTag.Base tag
  • white (was 0 )
  • orange (was 1 )
  • magenta (was 2 )
  • light_blue (was 3 )
  • yellow (was 4 )
  • lime (was 5 )
  • pink (was 6 )
  • gray (was 7 )
  • light_gray (was 8 )
  • cyan (was 9 )
  • purple (was 10 )
  • blue (was 11 )
  • brown (was 12 )
  • green (was 13 )
  • red (was 14 )
  • black (was 15 )
  • e.g. base_color='magenta'

minecraft:banner_patterns

  • Stores the additional patterns applied to a Banner or Shield
  • Copied to Banner block when placed
  • Replaces BlockEntityTag.Patterns tag
  • Replaces short banner pattern code in Patterns[].Pattern
  • Replaces integer dye color id in Patterns[].Color
  • e.g. banner_patterns=[{pattern:'minecraft:stripe_top',color:'red'}]
  • On Banners and Shields, has an implicit default value of: []
  • Can be modified with the set_banner_pattern loot function

minecraft:pot_decorations

  • Stores the Sherds applied to each side of a Decorated Pot
  • Copied to Decorated Pot block when placed
  • Replaces BlockEntityTag.sherds tag of same format
  • e.g. ['arms_up_pottery_sherd','angler_pottery_sherd','danger_pottery_sherd','shelter_pottery_sherd']
  • On Decorated Pots, has an implicit default value of: ['minecraft:brick','minecraft:brick','minecraft:brick','minecraft:brick']

minecraft:container

  • Holds the contents of container blocks (Chests, Shulker Boxes) in item form
  • Copied into container block when placed
  • Replaces BlockEntityTag.Items tag
  • slot : integer [0; 255], representing a slot in the container
  • item : item stack
  • e.g. container=[{slot:7,item:{id:'diamond_pickaxe',components:{'minecraft:unbreakable':{}}}}]
  • On container blocks, has an implicit default value of: []

minecraft:bees

  • Holds the bees inside a Beehive or Bee Nest
  • Copied to Beehive or Bee Nest block when placed
  • Replaces BlockEntityTag.Bees tag
  • id : entity id
  • The remainder tags merged into the Bee when spawned
  • ticks_in_hive : integer
  • min_ticks_in_hive : integer
  • e.g: bees=[{entity_data:{id='minecraft:bee'},ticks_in_hive:3,min_ticks_in_hive:10}]
  • On Beehive and Bee Nest, has an implicit default value of: []

minecraft:lock

  • An item with a custom name of the same value must be used to open this container
  • Copied to container block when placed
  • Replaces BlockEntityTag.Lock tag
  • e.g: lock='hunter2'

minecraft:container_loot

  • Holds the unresolved loot table and seed of a container-like block
  • Replaces BlockEntityTag.LootTable and BlockEntityTag.LootTableSeed tags
  • loot_table : loot table id
  • If not specified, or 0 , the seed will be picked randomly when the loot table is evaluated
  • e.g. container_loot={loot_table:'minecraft:chests/buried_treasure',seed:123}
  • Can be modified with the set_loot_table loot function

minecraft:block_entity_data

  • Stores unstructured NBT data to apply to a block entity when placing a block such as a Chest or Furnace
  • Replaces previous BlockEntityTag tag, with same behavior
  • Any block entity data moved into a dedicated item component is removed from this tag
  • For Command Blocks, Lecterns, Signs, and Spawners: this tag will not be copied unless the player is an operator
  • Must contain an id field with the block entity type
  • Any additional fields will be merged into the block entity when placed
  • e.g. block_entity_data={id:'minecraft:chest',Items:[{Slot:1,item:'minecraft:diamond'}]}

minecraft:block_state

  • Holds block state properties to apply when placing a block
  • Replaces BlockStateTag tag
  • All property values, including integer and boolean types, must be represented as strings
  • e.g: block_state={eggs:'10'}

New Item Stack Components

These are new components that did not exist in the previous item tag, and support new features and use-cases.

minecraft:enchantment_glint_override

  • Overrides the enchantment glint effect on an item
  • Can be used in the same way that an invalid Enchantments tag would previously behave to add a glint
  • If true , an item without an enchantment glint will display a glint
  • If false , an item with a glint will not display this glint (either from enchantments or intrinsic properties of the item)
  • e.g: enchantment_glint_override=true

minecraft:food

  • When present, this item will behave as if a food (can be eaten)
  • nutrition : non-negative integer, number of food points to restore when eaten
  • saturation : float, amount of saturation to restore when eaten
  • If true , this food can be eaten even if not hungry
  • The number of seconds that it takes to eat this food item
  • effect : effect instance (same format as custom_effects in minecraft:potion_contents component)
  • probability : float between 0 and 1, chance for the effect to be applied (default: 1 )
  • e.g: food={nutrition:4,saturation:0.1}
  • On food items, has an implicit default value for that food type

minecraft:max_stack_size

  • Controls the maximum stacking size of this item
  • Values greater than 1 are mutually exclusive with the max_damage component
  • e.g. max_stack_size=4
  • Has an implicit default value according to the item type (usually 64 )

minecraft:max_damage

  • Controls the maximum amount of damage than an item can take
  • Mutually exclusive with the max_stack_size component greater than 1
  • Requires that the damage component is also present on the item
  • If not present, the item cannot be damaged
  • e.g. max_damage=123
  • Has an implicit default value for damageable items

minecraft:tool

  • Controls the behavior of the item as a tool
  • blocks : single block, list of blocks, or # -prefixed block tag to match
  • speed (optional): float, overrides the mining speed if present and matched
  • true will cause the block to mine at its most efficient speed, and drop items if the targeted block requires that
  • default_mining_speed : float, mining speed to use if no rules match and override mining speed (default: 1.0 )
  • damage_per_block : non-negative int, amount of durability to remove each time a block is mined with this tool
  • e.g. tool={rules:[{blocks:"#mineable/pickaxe",speed:4.0,correct_for_drops:true}]}
  • Vanilla tool items will have an implicit default value based on their tier and tool type

minecraft:hide_tooltip

  • If present, it will completely hide whole item tooltip (that includes item name)
  • Tooltip will still be visible and searchable in creative mode
  • Format: empty object

minecraft:item_name

  • When present, replaces default item name with contained chat component
  • item_name can't be changed or removed in Anvil
  • item_name is not styled with italics when displayed to player
  • item_name does not show labels where applicable (for example: banner markers, names in item frames)

minecraft:fire_resistant

  • If present, this item will not burn in fire
  • e.g. fire_resistant={}
  • Has an implicit default value for fire-resistant items such as Netherite

minecraft:rarity

  • Controls the color of the item name
  • common (default): white name, or aqua when enchanted
  • uncommon : yellow name, or aqua when enchanted
  • rare : aqua name, or light purple when enchanted
  • epic : light purple name
  • e.g. rarity=rare
  • Special items such as Golden Apples have an implicit default value

minecraft:ominous_bottle_amplifier

  • Controls the amplifier amount for an Ominous Bottle's Bad Omen effect
  • e.g. ominous_bottle_amplifier=3
  • Can be modified with the set_ominous_bottle_amplifier loot function

Saved Item Stack Format

  • Along with format changes due to components, the structures of item stacks on disk and in data packs have been updated for consistency
  • This format is additionally applied to the icon field in advancements, items in chat component hover events, and the result field in smelting recipes ( result and count are no longer inlined)
  • The field will however always be stored by the game
  • The tag field has been removed, and any remaining contents will end up in the minecraft:custom_data component when upgrading
  • e.g. {..., components: {'minecraft:damage': 12}}
  • Components with a ! prefix (e.g. "!minecraft:damage": {} ) will cause this component to be removed
  • Components equal to their default value on the target item will not be stored
  • Instead, in places that support it, the field should be omitted
  • In some cases, such as lists of stacks (e.g. HandItems in living entities), an empty map ( {} ) is used to represent empty stacks

Entity & Block Entity Data Formats

  • Non-default components on item stacks are now stored when a block entity is placed from that item stack
  • The storage format of block positions in entities and block entities has been updated
  • Added body_armor_item and body_armor_drop_chance to all entities that currently have HandItems and ArmorItems , and handle the same way as HandItems and ArmorItems
  • Handling of Horses ArmorItem , Llamas DecorItem , and Wolf's armor has been changed to use body_armor_item and body_armor_drop_chance instead
  • By default, if no components are specified, any item will be accepted (similar to components field in item predicates)
  • amplifier : 0
  • duration : 0
  • ambient : false
  • show_particles : true
  • FactorCalculationData has been removed from mob effect instance tags
  • This is instead fetched from their held item
  • Potion -> potion_contents.potion
  • Color -> potion_contents.custom_color
  • effects -> potion_contents.custom_effects
  • Patterns[].Pattern (string short id) -> patterns[].pattern (string pattern registry id)
  • Patterns[].Color (integer dye id) -> patterns[].color (string dye name)
  • Bees[].EntityData -> bees[].entity_data
  • Bees[].TicksInHive -> bees[].ticks_in_hive
  • Bees[].MinOccupationTicks -> bees[].min_ticks_in_hive
  • FlowerPos -> flower_pos
  • The SkullOwner and ExtraType fields in Player Head blocks have been replaced with a profile field, with the same format as the item component
  • Player Head blocks now store a custom_name tag, which will be copied to and from the item form when broken or placed
  • If present, rolled items from the specified loot table will be equipped to the mob that spawns
  • loot_table - A loot table used to generate the equipment
  • Can also be a single value instead of a list to apply to all slots: e.g. slot_drop_chances: 0.0f will apply a chance of 0% to all slots
  • e.g. equipment: {loot_table: "minecraft:equipment/trial_chamber", slot_drop_chances: {"head": 0.0f, "chest": 0.25f, "legs": 1.0f, "feet": 0.25f}}

Components on Block Entities

Non-default components on item stacks containing block items are now stored on block entities when placed.

  • Component removals from defaults are currently not preserved
  • Placing and breaking non-block entity blocks remains unchanged - nothing is preserved
  • Does not automatically cause preserved components to be restored on drops - this requires addition of copy_components function to loot table
  • Some components (like custom_name ) are still handled by legacy serialization, which means they might not be present in there
  • Contains map of component id to component value

Block Positions

  • All block positions are now stored as an array of 3 integers instead of a map of X , Y , and Z for consistency
  • FlowerPos and HivePos in Bees have been renamed to flower_pos and hive_pos
  • FlowerPos in Beehives has been renamed to flower_pos
  • BeamTarget in End Crystals has been renamed to beam_target
  • Leash in all leashable entities has been renamed to leash
  • PatrolTarget in patrolling mobs has been renamed to patrol_target
  • ExitPortal in End Gateways has been renamed to exit_portal
  • WanderTarget in Wandering Traders has been renamed to wander_target

Vault Block Entity

  • Added Vault block (experimental) with a variety of NBT elements which can be configured for custom content:
  • Default value: "minecraft:chests/trial_chambers/reward"
  • Default value: 4
  • Default value: 4.5
  • The player must be holding an item with the exact components and count
  • If the field is not present, the Vault cannot be unlocked
  • Default value: No value
  • Updated syntax of items and item predicates in commands
  • Added slot names for ranges, like container.*
  • playsound command can now be used without specifying the player (assuming @s ) and without specifying the mixer (assuming master )
  • Command arguments that previously accepted namespaced ids of loot tables, modifiers and predicates can now also accept inline definitions
  • Added execute if|unless items to check and count items
  • The former behavior of effects such as Jump Boost, Levitation, and Mining Fatigue over 127 has been replaced with new attributes
  • Added the transfer command
  • The maximum length of a command in a function (including macro expansions) can no longer exceed 2,000,000 characters

Item Syntax

  • Commands such as /give , /item , /loot use an updated item syntax
  • Components are assigned with an = (e.g. wooden_pickaxe[damage=23] )
  • Components are comma-separated (e.g. netherite_hoe[damage=5,repair_cost=2] )
  • Component types will be autocompleted, but possible values of them will not
  • e.g. /give @s wooden_pickaxe[damage=-34] is not valid
  • e.g. /give @s stick{foo:'bar'} becomes /give @s stick[custom_data={foo:'bar'}]
  • add -> add_value
  • multiply_base -> add_multiplied_base
  • multiply -> add_multiplied_total

Added execute if|unless items

  • block <x> <y> <z>
  • entity <target> (selector can return multiple entities)
  • <slots> can accept single slot (like container.0 ) or a range (like container.* )
  • <item_predicate> is the same as item predicate in clear command
  • If used alone, it will return the total number of items in stacks that match predicates

Item Predicate Argument

The item predicate syntax (used in execute if|unless items and clear commands) has been significantly expanded.

  • The general syntax is: <type> [comma-separated list of <test>]
  • item tag id prefixed with #
  • * to match any item
  • <value> is a representation of component value in SNBT format (same as in item give argument)
  • Every specified component must be present on the target item, and have an exactly equal parsed value
  • As such, /clear @s diamond_pickaxe[damage=0] will match only undamaged Diamond Pickaxes
  • On the other hand, /clear @s diamond_pickaxe will match any Diamond Pickaxe, irrespective of damage
  • Exact matching of component values applies even for the minecraft:custom_data component
  • <component_id> - check if component exists
  • <value> is a representation of item sub-predicate in SNBT format (but otherwise the same as those used for advancement and loot table JSON files)
  • Example: *[damage~{durability:{min:3}}] will match any stack with at least 3 uses left
  • count=<positive int> will pass only when the stack size equals the given value
  • Example: *[count~{max:2}] will match any stack with count <= 2
  • count will always pass
  • Example: *[!count=1] will match any stack that has count other than 1
  • Example: *[!damage|damage=0] will look for items without damage component or with 0 damage
  • So stick{a:2} becomes stick[custom_data~{a:2}]
  • This requires that all tags specified in the predicate are present on the target item, but additional ones may be ignored
  • Lists in the target must contain all items specified in the predicate, but additional may be present and order is ignored
  • Slot names (used in item commands and slots entity predicates) now include slot ranges
  • Unless specified, existing commands can still only work on single slots
  • container.* - contains container.0 to container.53
  • hotbar.* - contains hotbar.0 to hotbar.8
  • inventory.* - contains inventory.0 to inventory.26
  • enderchest.* - contains enderchest.0 to enderchest.26
  • villager.* - contains villager.0 to villager.7
  • horse.* - contains horse.0 to horse.14
  • weapon.* - contains weapon.mainhand and weapon.offhand
  • armor.* - contains armor.head , armor.chest , armor.legs , armor.feet , armor.body
  • Note: this information cannot be read in creative mode
  • Note: this includes only player's inventory crafting slots. Crafting table (or any other slots on other screens) are not included
  • contents - for single-slot entities like item frames, item displays, or dropped item entities
  • Replaced horse.armor slot name with armor.body , which is applicable to all mobs

Inline loot values

Arguments in the following commands that previously accepted namespaced ids of loot tables, modifiers and predicates can now also accept inline definitions:

  • execute if predicate

Values have the same structure as matching JSON files, though they are encoded as SNBT.Example:

execute if predicate {condition:weather_check, raining:true}

transfer Command

New command that triggers a transfer of a player to another server. Only exists on dedicated servers.

transfer <hostname> [<port>] [<players>]

Parameters:

  • hostname : String describing the hostname of the server to connect to
  • port : Integer denoting the port number of the server to connect to - if omitted, 25565 is used
  • players : The players to transfer - if omitted, @s is used

Predicate Formats in Loot Tables & Advancements

  • tag field has been removed
  • blocks field now supports a single entry, hash-prefixed block tag, or list of blocks
  • fluid -> fluids , and supports a single entry, hash-prefixed fluid tag, or list of fluids
  • biome -> biomes , and supports a single entry, hash-prefixed biome tag, or list of biomes
  • structure -> structures , and supports a single entry, hash-prefixed structure tag, or list of structures
  • Major changes to Entity and Item predicates

Entity Predicates

  • type field now supports a single entry, hash-prefixed entity type tag, or list of entity types
  • Added new entity predicate field slots , for matching item slots
  • Added a new body field to match the item in the body armor slot of an entity
  • Removed any entity type-specific predicate (which had no effect)

slots entity predicate field

  • The new entity field slots allows checking a single or multiple slots on any entity
  • The field contains a map of slot names (same as those used in item commands) to item predicates
  • For slot ranges, only one slot needs to match for the whole entry to pass

wolf type-specific entity predicate

  • New wolf sub-predicate has been added to match Wolf variants
  • variant - Wolf variant to match (single entry, list of entries or tag)

raider type-specific entity predicate

  • New raider sub-predicate has been added to match raiders
  • has_raid - Match whether the raider is in an active raid
  • is_captain - Match whether the raider is a captain

cat , frog , painting type-specific entity predicate

  • The variant field now accepts single entries, list of entries or tags

Item Predicates

Item predicate format has been updated:

  • items field now supports a single entry, hash-prefixed item tag, or list of items
  • All specified components must be present and exactly equal on the target item, but additional components may be ignored
  • Components with defaults will be assumed to exist on the target item if not specified
  • e.g. "components": { "minecraft:damage": 0 } will match only undamaged items
  • Component-specific item predicate properties have been moved to a separate field called predicates

Item Sub-predicates

  • Some fields from item predicate have been moved to a map in an optional field predicates
  • The new field is similar to the components field on item stacks
  • This was done to simplify addition for future predicates and to allow sub-predicates to more closely resemble names of components they match
  • enchantments - field moved to sub-predicate minecraft:enchantments
  • stored_enchantments - field moved to sub-predicate minecraft:stored_enchantments
  • Now supports a single potion entry, list of potions, or hash-prefixed potion tag
  • custom_data - field moved to sub-predicate minecraft:custom_data
  • This check now works for any item that has minecraft:damage component
  • An item that does not have a minecraft:damage component can never match
  • To check for unbreakable items, query value of minecraft:unbreakable component
  • damage - optional bounds for value of minecraft:damage component
  • durability - optional bounds for durability (max damage minus value of minecraft:damage )
  • That means that, for example, matching for empty enchantment list will not pass on items without minecraft:damage component
  • Note: some components, like minecraft:enchantments have default values, so they will always match
  • These sub-predicates can also be referenced in commands such as /clear and /execute if|unless items
  • That means that *[custom_data~{a:1}] and *[custom_data~"{a:1}"] are equivalent
  • Flattened string format has been kept since NBT type information can't be expressed in JSON
  • Many new sub-predicates have been introduced

General Rules of Component Predicates

  • Unless otherwise specified, a field in predicate with the same name as a field in component that matches (i.e. has the same name as predicate) will match that field value
  • Those fields will usually have the same type as in the components, but will be optional
  • List fields will be replaced with collection matchers (see below)
  • Integer and float fields will be replaced with ranges
  • Registry ids will be replaced with a type that accepts id, list of ids or a tag

Collection Matcher

  • A collection matcher is a shared part of predicates that is used for matching collections
  • Every instance of this matcher will have the same fields with the same functionality, with the only difference being the type of matched element
  • size - integer range to match against collection size
  • All conditions must match for the predicate to pass
  • Not all elements in the tested container have to be matched
  • Elements can be in any order
  • A single element can be matched by multiple predicates
  • {contents:[{item:diamond}]} - will match when there is at least one diamond item
  • {contents:[{item:diamond}, {item:dirt}]} - will match when there is at least one diamond item and at least one dirt item
  • test - element matcher
  • count - optional integer range to check against number of elements passing test
  • {count:[{count:3,test:{items:diamond}}]}} will match only when there are exactly 3 stacks of diamonds (no matter the stack size)
  • Matcher for container component (like Shulker Box)
  • Note: empty items are ignored. That means container~{items:{size:3}} will only pass if there are exactly 3 non-empty stacks in container

bundle_contents

  • Matcher for bundle_contents component
  • items - optional collection matcher

firework_explosion

  • Matcher for firework_explosion component
  • shape - optional matcher for shape, same values as shape field in minecraft:firework_explosion component
  • has_trail - optional boolean
  • has_twinkle - optional boolean
  • Matcher for fireworks component
  • explosions - optional collection matcher for firework_explosion predicates
  • flight_duration - optional integer range check for flight duration
  • Example: minecraft:fireworks~{explosions:{contains:[{shape:small_ball}]}}] - matches if firework has at least one explosion with small_ball shape

writable_book_content

  • Matcher for writable_book_content component
  • pages - optional collection matcher for strings (matching only the unfiltered/raw contents of each page)

written_book_content

  • Matcher for written_book_content component
  • pages - optional collection matcher for chat components (matching only the unfiltered/raw contents of each page)
  • author - optional string value
  • title - optional string value (matching only value)
  • generation - optional integer range check for generation
  • resolved - optional boolean

attribute_modifiers

  • Matcher for attribute_modifiers component
  • attribute - optional id, list of ids or tag for attribute to be matched
  • id - optional UUID
  • name - optional string
  • amount - optional double range check
  • operation - optional operation type (same values as operation field from attribute_modifiers component)
  • slot - optional applicable slot type (same values as slot field from attribute_modifiers component)
  • Matcher for trim component
  • material - optional id, list of ids or tag for material to be matched
  • pattern - optional id, list of ids or tag for pattern to be matched

Changes to item_used_on_block

  • For example, when using an Axe to scrape Oxidized Copper blocks would trigger, while using an Axe on a Crafting Table would not

Added default_block_use

  • Triggers due to the default interaction of a block by a player, such as opening a door

Added any_block_use

  • Triggers due to any type of interaction with a block by a player, such as using an item on the block or its default usage

Added crafter_recipe_crafted

  • Triggered when a Crafter ejects a successfully crafted item into the world
  • player - an entity predicate matching nearby players in an 8 block radius
  • recipe_id - the ID of the recipe being crafted
  • ingredients - a list of item predicates matching the ingredients that form the recipe being crafted

Added fall_after_explosion

  • Triggered when a player begins falling after being knocked upwards by an explosion or wind burst
  • player - entity predicate matching the player who is falling
  • start_position - location predicate matching the position the player was at when they were hit by the explosion or burst
  • distance - distance predicate matching how far the player must be from start_position to cause the trigger to activate
  • cause - entity predicate matching the entity that caused the explosion or burst to happen

Loot Tables

  • Added gameplay/panda_sneeze loot table for drops when Pandas sneeze
  • namespaced id - reference to another named loot table
  • full loot table (same format as in standalone file)
  • Added new loot table type minecraft:equipment used for equipping items onto mobs

storage Number Provider

  • This number provider can access numeric values from command storage directly
  • If selected storage does not exist or tag selected by path is not numeric or does not exist, the provider returns 0
  • storage - namespaced id of command storage
  • path - NBT path to field

Modified Loot Functions

  • Nested lists are no longer supported in function lists

set_contents

  • The type field has been removed
  • Describes the target item stack component to be filled with items
  • Any existing contents will be replaced
  • Allowed values: container , bundle_contents , charged_projectiles
  • bundle_contents and charged_projectiles will ignore empty stacks

set_custom_data (renamed from set_nbt )

  • Now applies to the custom_data component of the target item
  • The tag field now accepts both SNBT data written as a string (existing format) and unflattened tags

copy_custom_data (renamed from copy_nbt )

  • Added optional field target to specify which name should be set
  • custom_name - sets custom_name component (default)
  • item_name - sets item_name component

set_attributes

  • The modifier slot field now supports any , armor , hand , and body values
  • addition -> add_value
  • multiply_total -> add_multiplied_total
  • When false , attributes will be appended
  • The replace field has been removed
  • Now has mode like set_fireworks and set_written_book_pages

New Loot Functions

Set_components.

  • Adds or replaces provided components on the target item
  • conditions - optional list of conditions to filter this function

copy_components

  • Copies components from a specified source onto an item
  • This is now used in the Vanilla pack in place of the copy_name and copy_nbt functions
  • Currently, can only and must be "block_entity"
  • if omitted, all components present are included
  • if omitted, defaults to empty
  • Only components that are included (explicitly or implicitly) but not excluded will be copied

modify_contents

  • Applies a modifier function to every item inside of a component
  • If the component does not exist, it will not be added
  • modifier - function or list of functions to be applied to every item inside container
  • Replaces item type of item stack without changing its count and components
  • item - new item type
  • Applies a sub-function only to items that match item predicate
  • item_filter - item predicate used to match items
  • modifier - functions to apply to matching items

set_custom_model_data

  • Sets the custom_model_data component on the target item according to a number provider
  • value - integer number provider

set_ominous_bottle_amplifier

  • Sets the ominous_bottle_amplifier component on the target item according to a number provider
  • amplifier - a number provider used to generate the ominous_bottle_amplifier component

set_fireworks

  • Sets the details of the minecraft:fireworks component
  • Conditions to check before applying the function
  • The flight duration measured in number of gunpowder
  • If omitted, the flight duration of the item is left untouched - or set to 0 if the component did not exist before
  • The explosion data to set
  • replace_all : fully replace the explosions list
  • Start of replaced range
  • If omitted, 0 is used
  • Size of range to be replaced in explosions
  • If omitted, the size of explosions field is used
  • Index before which explosions will be inserted
  • If omitted, 0 (before first explosion) is used
  • append : append explosions at the end of the list

set_firework_explosion

  • Sets the details of the minecraft:firework_explosion component
  • The explosion shape to set
  • If omitted, the original shape is kept (or small_ball is used if there was no component)
  • List of initial particle colors to replace the ones on the existing explosion with
  • If omitted, the original colors are kept (or [] is used if there was no component)
  • List of fade-to particle colors to replace the ones on the existing explosion with
  • Set whether the explosion should have a trail or not
  • If omitted, the original has_trail value is kept (or false is used if there was no component)
  • Set whether the explosion should have a twinkle or not
  • If omitted, the original has_twinkle value is kept (or false is used if there was no component)

set_book_cover

  • Sets the cover details of the minecraft:written_book_content component
  • If present, any pages in the book are left untouched
  • The title to set
  • If omitted, the original title is kept (or an empty string is used if there was no component)
  • The author to set
  • If omitted, the original author is kept (or an empty string is used if there was no component)
  • The generation value to set
  • If omitted, the original generation is kept (or 0 is used if there was no component)

set_writable_book_pages

  • Manipulates the pages of the minecraft:writable_book_content component
  • The pages to apply
  • replace_all : fully replace the book contents
  • Size of range to be replaced in book
  • If omitted, the size of pages field is used
  • Index before which pages will be inserted
  • If omitted, 0 (before first page) is used
  • append : append pages at the end of the book

set_written_book_pages

  • Manipulates the pages of the minecraft:written_book_content component
  • Unlike the written_book_content component, pages stores a list of JSON objects instead of JSON in string form
  • Any cover data is left untouched, and the page content components are set to resolve next time a player opens the book

toggle_tooltips

  • This function can be used to modify item component tooltip visibility
  • It works by setting fields like show_in_tooltip without changing other values
  • toggles - a map of supported item component type to boolean value
  • Supported components: trim , dyed_color , enchantments , stored_enchantments , unbreakable , can_break , can_place_on , attribute_modifiers
  • {function:"toggle_tooltips","toggles":{"enchantments":false}} will hide enchantments tooltip
  • Recipe types crafting_shaped , crafting_shapeless , stonecutting and smithing_transform now accept components for the result item stack
  • This result now also accepts components data
  • Shulkers can only be scaled up to 3x their normal size
  • The Ender Dragon cannot be scaled
  • Added player.block_interaction_range (default: 4.5 ) and player.entity_interaction_range (default: 3.0 ) attributes that control player reach distance
  • Added generic.step_height attribute that defines the maximum number of blocks that an entity can step up without jumping (default: 0.6 )
  • Added generic.gravity attribute that controls blocks/tick^2 acceleration downward (default: -0.08 )
  • Added generic.safe_fall_distance attribute to control the fall distance after which the entity will take fall damage (default: 3.0 )
  • Added generic.fall_damage_multiplier attribute to multiply overall applied fall damage (default: 1.0 )
  • This controls the base impulse from a jump (before jump boost or modifier on block)
  • Added player.block_break_speed attribute that acts as a multiplier over block breaking speed for players (default: `1.0)

Added the following particle types:

  • vault_connection
  • item_cobweb
  • trial_spawner_detection_ominous
  • ominous_spawning

Particle Representation

  • Particle options in commands and in fields like Particles in Area Effect clouds now use the same representation as worldgen files (like existing biomes' ambient particle settings)
  • For example, command /particle minecraft:dust 1.0 0.0 0.0 2.0 ... becomes /particle minecraft:dust{color:[1.0, 0.0, 0.0], scale:2.0} ...
  • The syntax for particles without extra options (like minecraft:villager ) remains unchanged
  • Field value has been renamed to block_state
  • Field block_state now also accepts plain block name to represent default block state
  • minecraft:block minecraft:redstone_lamp[lit=true] -> minecraft:block{block_state: {Name: "minecraft:redstone_lamp", Properties: {lit: "true"}}}
  • minecraft:block minecraft:diamond_block -> minecraft:block{block_state: "minecraft:diamond_block"}
  • Field value has been renamed to item
  • Field item now also accepts plain item name to represent item stack with default components
  • count field is now ignored
  • minecraft:item minecraft:dirt -> minecraft:item{item: {id: "minecraft:dirt"}}
  • minecraft:item minecraft:dirt -> minecraft:item{item: "minecraft:dirt"}
  • The fromColor field has been renamed to from_color
  • The toColor field has been renamed to to_color
  • Example transformation: dust_color_transition 1.0 0.0 0.0 0.5 0.0 1.0 0.5 -> dust_color_transition{from_color: [1.0f, 0.0f, 0.0f], scale: 0.5f, to_color: [0.0f, 1.0f, 0.5f]}
  • Now accepts options to control the color of the particle
  • color : packed integer ARGB color, or list of floats (0.0 to 1.0) representing RGBA color

Enchantments

  • The minecraft:sweeping enchantment has been renamed to minecraft:sweeping_edge
  • Projectile weapon Enchantments like infinity , multishot and piercing now work on both Crossbows and Bows, if placed onto the alternative weapon using data manipulation or a change to the enchantable/* tags)

Damage Types

  • Llamas now use a new damage type spit instead of mob_projectile
  • Added minecraft:does_not_block_hoppers for blocks that will never disable a Hopper when placed above one
  • Added minecraft:blocks_wind_charge_explosions for blocks not impacted by the explosion when hit by Wind Charge
  • These tags combine the existing needs_diamond_tool , needs_iron_tool , and needs_stone_tool tags for each specific tool tier

New item tags controlling what enchantments can be added to what gear:

  • minecraft:enchantable/foot_armor
  • minecraft:enchantable/leg_armor
  • minecraft:enchantable/chest_armor
  • minecraft:enchantable/head_armor
  • minecraft:enchantable/armor
  • minecraft:enchantable/weapon
  • minecraft:enchantable/sword
  • minecraft:enchantable/mining
  • minecraft:enchantable/mining_loot
  • minecraft:enchantable/fishing
  • minecraft:enchantable/trident
  • minecraft:enchantable/durability
  • minecraft:enchantable/bow
  • minecraft:enchantable/equippable
  • minecraft:enchantable/crossbow
  • minecraft:enchantable/vanishing

New item tags defining food and tempting items for various mobs:

  • minecraft:armadillo_food
  • minecraft:axolotl_food (renamed from minecraft:axolotl_tempt_items )
  • minecraft:bee_food
  • minecraft:camel_food
  • minecraft:cat_food
  • minecraft:chicken_food
  • minecraft:cow_food
  • minecraft:fox_food
  • minecraft:frog_food
  • minecraft:goat_food
  • minecraft:hoglin_food
  • minecraft:horse_food
  • minecraft:horse_tempt_items
  • minecraft:llama_food
  • minecraft:llama_tempt_items
  • minecraft:meat collection tag: not used by the game directly, but may be included in other tags
  • minecraft:ocelot_food
  • minecraft:panda_food
  • minecraft:parrot_food
  • minecraft:parrot_poisonous_food
  • minecraft:pig_food
  • minecraft:piglin_food
  • minecraft:rabbit_food
  • minecraft:sheep_food
  • minecraft:strider_food
  • minecraft:strider_tempt_items
  • minecraft:turtle_food
  • minecraft:wolf_food

Removed item tags:

  • Removed tag minecraft:tools (overlapping with minecraft:breaks_decorated_pots )

Entity Type Tags

  • Added minecraft:ignores_poison_and_regen for entities that cannot be affected by Poison and Regeneration effects
  • Added minecraft:illager_friends for entities that Illagers will consider allies (unless on a different team)
  • Added minecraft:immune_to_infested for entities that cannot receive the Infested mob effect
  • Added minecraft:immune_to_oozing for entities that cannot receive the Oozing mob effect
  • Added minecraft:inverted_healing_and_harm for entities that have inverted meanings of the Healing and Harm effects
  • Added minecraft:not_scary_for_pufferfish for entities that will not cause Pufferfish to puff
  • Added minecraft:redirectable_projectile for projectiles which should be able to be redirected and deflected toward the direction the player is looking
  • Added minecraft:sensitive_to_bane_of_arthropods for entities sensitive to Bane of Arthropods
  • Added minecraft:sensitive_to_impaling for entities sensitive to Impaling
  • Added minecraft:sensitive_to_smite for entities that take extra damage from the Smite Enchantment
  • Added minecraft:wither_friends for entities that the Wither will not target and which cannot harm the Wither

Damage Type Tags

  • Added minecraft:bypasses_wolf_armor for damage sources that cannot be absorbed by Wolf Armor
  • Added minecraft:is_player_attack for attacks performed by the player

Enchantment Tags

  • Added minecraft:tooltip_order controlling which order Enchantments are listed in tooltips

Banner Patterns

Banner Patterns will now be loaded into a dynamic registry from data packs ( data/<namespace>/banner_pattern/<id> )

  • e.g. custom:pattern resolves to assets/custom/textures/entity/banner/pattern.png , assets/custom/textures/entity/shield/pattern.png
  • e.g. block.minecraft.banner.custom.pattern resolves to block.minecraft.banner.custom.pattern.<dye color>

Wolf variants can be data-driven by adding entries to data/<namespace>/wolf_variant/<id>.json .

  • <namespace>:<path> resolves to assets/<namespace>/textures/<path>.png
  • tame_texture - tamed texture for this variant
  • angry_texture - to angry texture for this variant
  • biome - a single entry, list or a tag describing biomes in which this variant naturally spawns

Worldgen Data Formats

  • Density will be added all around every piece of a structure
  • Ideal for structures that need to be entirely covered underground
  • For example, {"type":"minecraft:uniform","value":{"min_inclusive":0.0,"max_inclusive":1.0}} becomes {"type":"minecraft:uniform","min_inclusive":0.0,"max_inclusive":1.0}

Resource Pack Versions 23 through 32

The Resource Pack version is now 32. These are the changes compared to version 22, used in 1.20.4.

  • Renamed scute textures and models to turtle_scute
  • Added textures and models for new features
  • Changes to fonts
  • Changes to shaders

Models and Textures

  • Added textures for Wolf variations
  • Added files for Armadillo and Wolf Armor
  • textures/entity/wolf/wolf_armor_overlay.png
  • textures/item/wolf_armor_overlay.png
  • textures/entity/wolf/wolf_armor_crackiness_low.png
  • textures/entity/wolf/wolf_armor_crackiness_medium.png
  • textures/entity/wolf/wolf_armor_crackiness_high.png
  • Added trial_chambers map decoration icon

Ominous Vault

Ominous trial spawner, ominous bottle.

  • bad_omen_121
  • wind_charged
  • Added gui/menu_background to be used as the background of screens, while gui/menu_list_background is used for the background of lists for menus accessed from the Title Screen
  • Added gui/inworld_menu_background , gui/inworld_menu_list_background , gui/inworld_header_separator , gui/inworld_footer_separator textures for menus accessed from the Pause Menu
  • Lists now use the gui/header_separator and gui/footer_separator textures at the top and bottom, respectively
  • The following textures have been updated: gui/footer_separator , gui/header_separator
  • The following sprites have been updated: widget/tab , widget/tab_highlighted , widget/tab_selected , widget/tab_selected_highlighted
  • The widget/scroller_background sprite has been added
  • The following textures in Realms have been removed: gui/sprites/backup/changes , gui/sprites/backup/changes_highlighted , gui/sprites/backup/restore , gui/sprites/backup/restore_highlighted , gui/sprites/player_list/make_operator_highlighted , gui/sprites/player_list/remove_operator_highlighted , gui/sprites/player_list/remove_player_highlighted
  • Added gui/tab_header_background texture, which is rendered behind the tab buttons in the Create World Screen
  • Added misc/credits_vignette texture, which is rendered behind the poem and the credits
  • Split map decoration atlas into separate files

Map Decorations

  • Map decoration icons have been split from the former map_icons.png to use an atlas loaded from the textures/map/decorations/ directory
  • The process of upgrading your pack can be assisted by using this automated Slicer tool
  • shift is no longer applied double, and now directly represents a number of pixels in the game UI
  • The font EM square is fitted to size pixels in the game UI, instead of between the font ascender and font descender
  • The font baseline is positioned consistently with the default font (7 pixels below line top)
  • This means that generally, any font with a size of 9 and no shift should look correct by default
  • shift is now restricted to the range [-512; 512]
  • Added font variant filters to font providers

Font Variant Filters

  • Every glyph provider can now be enabled or disabled based on certain set of variants
  • uniform - wired to "Force Uniform" button
  • jp - wired to "Japanese Glyph Variants" button
  • Keys in that object are variant names (for example uniform )
  • Glyph provider will be included only when value in filter matches actual value of variant in key
  • The unused attributes array in core shader definitions has been removed
  • The unused position_color_normal and position_tex_lightmap_color shaders have been removed
  • The position_tex_color_normal shader (only used by clouds) has been replaced with rendertype_clouds
  • The IViewRotMat uniform has been removed, and the Position attribute for entities is now in (camera relative) world space
  • Light direction uniforms are no longer premultiplied by the view matrix
  • The blur post-processing shader has been renamed to box_blur
  • Added optional boolean field use_linear_filter to post-processing passes which when set to true switches texture sampling mode from nearest-neighbor sampling to linear interpolation for that pass
  • Added entity_outline_box_blur post-processing shader

Sound Events

Added the following sound events:

  • block.cobweb.break
  • block.cobweb.fall
  • block.cobweb.hit
  • block.cobweb.place
  • block.cobweb.step
  • block.trial_spawner.about_to_spawn_item
  • block.trial_spawner.ambient_charged
  • block.trial_spawner.charge_activate
  • block.trial_spawner.spawn_item_begin
  • block.trial_spawner.spawn_item
  • event.mob_effect.bad_omen
  • event.mob_effect.raid_omen
  • event.mob_effect.trial_omen
  • item.ominous_bottle.dispose

A Bogged is aiming its bow at something at night in a Swamp. It is a Skeleton with moss on its bones and Mushrooms growing on its head. The Moon is rising between Mangrove trees in the background.

A Bogged is a Skeleton with moss on its bones and Mushrooms growing on its head. Click here for a link to the full-size image.

Noor is jumping from one tall Jungle tree to another using a Wind Charge to launch themselves high into the air. There is a mountain overgrown with Bamboo Forest in the background.

Noor is jumping from one tall Jungle tree to another using a Wind Charge to launch themselves high into the air. Click here for a link to the full-size image.

Noor is attacking a Piglin Brute by jumping from the top of a Bastion Remnant with a Mace. There is a Crimson Forest in the background.

Noor is attacking a Piglin Brute by jumping from the top of a Bastion Remnant with a Mace. Click here for a link to the full-size image.

Noor is using a Mace with a Wind Burst enchantment to fight a group of Pillagers next to a Pillager Outpost. One of the Pillagers is dramatically thrown towards the viewer by the Wind Burst explosion, while the others are aiming their Crossbows at Noor.

Noor is using a Mace with a Wind Burst enchantment to fight a group of Pillagers next to a Pillager Outpost. Click here for a link to the full-size image.

Noor is fighting in Trial Chambers with Trial Omen effect. The Zombies who are trying to attack Noor are wearing Chainmail Armor with Armor Trims. There are multiple Lingering potion effect clouds present in the chamber with another potion about to burst.

Noor is fighting in Trial Chambers with Trial Omen effect. Click here for a link to the full-size image.

Noor is standing on an Oxidized Copper stairway in Trial Chambers and looking at an Ominous Trial Key which has appeared on top of a Trial Spawner as a reward after a difficult fight.

Noor is standing on an Oxidized Copper stairway in Trial Chambers and looking at an Ominous Trial Key. Click here for a link to the full-size image.

Noor is about to open an Ominous Vault with an Ominous Trial Key in Trial Chambers.

Noor is about to open an Ominous Vault with an Ominous Trial Key in Trial Chambers. Click here for a link to the full-size image.

Experimental Features

The following changes only apply when their respective Experiment is turned on, either by activating the corresponding experimental data pack or by turning it on in the Experiments screen while creating the world.

  • Added the Mace
  • Added Breeze Rod item
  • Updates to the Breeze
  • Added Wind Charge Item
  • Added Vault block
  • Redesigned Bad Omen to give access to Ominous Events
  • Added Ominous Bottle
  • Added Ominous Trial Spawner
  • Added Ominous Vault
  • Added Ominous Trial Key
  • Added Bogged mob
  • Added 6 new mob effects
  • A new heavy weapon to smash your enemies!
  • Can be crafted with a Breeze Rod and a Heavy Core
  • Try it out by jumping down toward your target, and hit them before you hit the ground
  • Successfully striking a target in this way will reset all vertical momentum and negate any fall-damage accumulated from the fall
  • Other entities near the struck enemy will be knocked back by the immense force of the Mace
  • Using a Mace will decrease its durability like any other weapon; repair it with Breeze Rods at an anvil
  • Players can use a Mace in combination with Wind Charges to launch up and deliver devastating smash attacks on their enemies
  • The baseline additional damage dealt by the Mace smash attack is 3 (1.5 hearts) per fallen block
  • Bane of Arthropods
  • Fire Aspect
  • Curse of Vanishing
  • Common Enchantment, accessible in the Enchanting Table and on Enchanted Books in loot
  • Has 5 levels
  • Damage dealt per fallen block is increased by 1 per level of Density
  • Rare Enchantment, accessible in the Enchanting Table and on Enchanted Books in loot
  • Has 4 levels
  • The effectiveness of the armor is reduced by 15% per Breach level
  • Unique enchantment which can only be found in Ominous Vaults
  • Has 3 levels
  • Maces enchanted with Wind Burst will emit a Wind Burst upon hitting an enemy, launching the attacker upward and enabling the linking of smash attacks one after the other
  • Each level will bounce the attacker higher up in the air
  • A mysterious, dense block which can be combined with a Breeze Rod to craft a brand-new weapon: the Mace!
  • An item dropped by the Breeze that can be crafted into 4 Wind Charges, or used with the Heavy Core to craft the Mace
  • The number of Breeze Rods dropped is affected by looting enchantments
  • Added new sound effects, as well as tweaked existing sounds
  • Breeze now deflects all projectiles
  • Deflected projectiles now deflect in the direction of the shooter
  • Breeze is now aggressive toward Iron Golems
  • The above mobs will not retaliate when hurt by the Breeze's Wind Charge Projectile
  • Updated the model, texture, and animation of the Wind Charge projectile to give it a more dynamic look and feel

Wind Charge

  • Become the Breeze! Using a Wind Charge item will fire off a Wind Charge projectile similar to the Breeze's
  • The Wind Charge can be used to launch entities away from the impact of the Wind Burst
  • Players can also use Wind Charges to propel themselves high into the air
  • A Wind Charge fired by a player will grant 10% more knockback than a Breeze's, but have a much smaller area of impact
  • Just like the projectile fired by the Breeze, Wind Charges fired by the player also deal damage if they hit an entity directly
  • There is a half-second cooldown after each use
  • Wind Charges can be fired from a dispenser
  • This means, for example, if a player uses a Wind Charge at y64 to launch themselves 9 blocks into the air, and they land back where they started at y64, they will take 0 damage.

Trial Spawner

  • The Trial Spawner now has the same two default loot tables as they have in the Trial Chamber
  • Trial spawners can now only activate when a player is in line of sight

Trial Chambers

  • Trial Chambers are now more consistently buried by terrain when found underground
  • Ominous Vaults can now be found inside rooms, intersections and at the end of corridors
  • Decorated Pots in the Trial Chambers now have a chance to display a Flow, Guster, or Scrape Pottery Sherd
  • Redesigned dispenser traps
  • Redesigned chamber room 9 to Slanted room
  • Redesigned chamber room 3 to Pedestal room
  • Redesigned chamber room 5 to Eruption room
  • Redesigned chamber room 6 to Assembly room
  • Updated layout and placements of Vaults
  • Reduced amount of Trial Spawners in corridors
  • Added an atrium to the corridors
  • Made various layout changes in intersections and corridors

Known issue:

  • Corner quadrants in slanted may still fail to generate correctly
  • Updated texture to reflect new Vault visuals

Trial Chamber Explorer Map

  • Struggle no more to locate a Trial Chamber - level up your nearest Cartographer to Journeyman for the opportunity to trade for an Explorer Map pointing to a nearby Trial Chamber
  • Can be found throughout Trial Chambers, containing the structures' most valuable loot
  • Vaults in Trial Chambers require a Trial Key to be unlocked
  • After a player has unlocked a Vault, they cannot unlock that Vault again
  • If a player has not unlocked that Vault before, an orange stream of particles will flow from the player to the Vault when nearby
  • If any nearby player has not unlocked that Vault, the keyhole will be open
  • If all nearby players have unlocked that Vault, the keyhole will be closed
  • Within its cage, it will cycle through and display items which are possible to eject from its loot table
  • The loot it ejects is randomized each time it is unlocked
  • Cannot be crafted nor obtained in Survival, and does not drop anything when mined
  • Vaults are explosion resistant and cannot be moved

Ominous Events

  • Bad Omen has been expanded to give access to an optional experience in Trial Chambers
  • They are more challenging than usual, and are designed to shake up the experience in unique ways
  • Illager Raids are an example of an existing Ominous Event
  • It has a new, shadowy icon and a sound for being applied to the player
  • Instead, it will transform into a Raid Omen variant with a duration of 30 seconds
  • Once the Raid Omen expires, a Raid will start at the location the player gained the Raid Omen
  • Like any other effect, players can drink a Bucket of Milk to clear the Raid Omen to prevent the Raid from starting
  • Instead, players can gain access to Bad Omen by consuming a new Ominous Bottle

An infographic explaining the Ominous Event System, as explained below.

Click here for a link to the full-size image.

  • Comes in 5 variations, one for each Bad Omen level
  • The bottle breaks when consumed
  • Can be stacked to 64
  • Ominous Bottles can be found uncommonly in any Vaults that are unlocked with Trial Keys, and are dropped by Raid Captains when defeated outside a Raid

Ominous Trials

  • A new Ominous Event that can be accessed by exploring a Trial Chamber with Bad Omen
  • This event will have players facing more powerful Trial Spawners if they dare!
  • This occurs when the player is within detection range of a Trial Spawner that is not Ominous
  • The Trial Omen has a duration of 15 minutes multiplied by the transformed Bad Omen's level
  • Players that have Trial Omen are surrounded by ominous particles
  • Provides a more challenging experience that advanced players can opt into for better rewards
  • It is not in cooldown
  • Making it Ominous this way will bypass the cooldown
  • Glow blue instead of orange
  • Emit soul flames instead of normal flames
  • The equipment these mobs wear have Armor Trims applied from the Trial Chambers
  • They also have various high-level enchantments
  • Based on their location, spawners in an area will select a random set of projectiles to spawn
  • These projectiles will always include a single type of Lingering Potion from a set of possible effects
  • It will stay Ominous until it has been defeated and its cooldown has finished
  • When defeated, it will eject a different set of loot compared to normal Trial Spawners

Ominous Trial Key

  • A new variant of the Trial Key which can only be obtained by defeating an Ominous Trial Spawner
  • They can be used to unlock Ominous Vaults
  • A variant of Vaults that have a different texture and emit soul flames instead of normal flames
  • These Vaults hold a more valuable set of rewards than the standard Vaults unlocked by Trial Keys
  • They're faster to take down with 16 health instead of 20 health
  • They attack at a slower interval of 3.5 seconds instead of 2 seconds
  • Bogged has a chance to drop Arrows of Poison when killed by players
  • Can also be found spawning from Trial Spawners in some Trial Chambers
  • The Bogged drops 2 mushrooms (either both red/brown or one of each) when sheared

Mob Effects

  • Affected entities will emit a wind burst upon death
  • Brewed with an Awkward Potion and a Breeze Rod
  • Affected entities will spread Cobweb blocks upon death
  • Affected entities can move through Cobweb with 50% of their normal speed instead of 25%
  • Brewed with an Awkward Potion and a Cobweb block
  • Affected entities will spawn two Slimes upon death
  • Brewed with an Awkward Potion and a Slime Block
  • Affected entities have a 10% chance to spawn 1-2 Silverfish when hurt
  • Brewed with an Awkward Potion and a Stone block
  • These effects can be encountered while taking on an Ominous Trial Spawner
  • Slimes are immune to Oozing
  • Silverfish are immune to Infested
  • If the amount exceeds the max entity cramming cap (24 by default), it will not spawn any Slimes
  • If it does not exceed it, it will attempt to spawn 2 Slimes up until the max entity cramming cap

Copper Grates

  • Stonecutting Copper Blocks into Copper Grates outputs 4 Copper Grates

Pottery Sherds

  • Added Flow, Guster, and Scrape Pottery Sherds
  • These can be obtained by breaking Decorated Pots that display them in Trial Chambers
  • Added Flow and Guster Banner Patterns

Armor Trims

  • Added Bolt and Flow Armor Trims and Smithing Templates
  • Bolt can be duplicated using a Copper Block or Waxed Copper
  • Flow can be duplicated using a Breeze Rod
  • Minecraft: Trial(s) Edition - Step foot in a Trial Chamber
  • Under Lock & Key - Unlock a Vault using a Trial Key
  • Blowback - Kill a Breeze with a deflected Wind Charge (challenge - gives 40 exp)
  • Who Needs Rockets? - Use a Wind Charge to launch yourself upward at least 8 blocks
  • Crafters Crafting Crafters - Be near a Crafter when it crafts a Crafter
  • Lighten Up - Scrape a Copper Bulb with an Axe to make it brighter
  • Over-Overkill - Deal 50 hearts of damage in a single hit using the Mace (challenge - gives 50 exp)
  • Revaulting - Unlock an Ominous Vault with an Ominous Trial Key (goal)

Trade Rebalance

  • In the Trade Rebalance Experiment, Villagers who buy armor now ignore durability and can buy damaged armor

Fixed bugs in 1.20.5

Around 210 bugs were fixed in this release. View the list on the issue tracker .

Get the Release

To install the Release, open up the Minecraft Launcher and click play! Make sure your Launcher is set to the "Latest Release” option.

Cross-platform server jar:

  • Minecraft server jar

Report bugs here:

  • Minecraft issue tracker !

Want to give feedback?

  • For any feedback and suggestions, head over to the Feedback site . If you're feeling chatty, join us over at the official Minecraft Discord .

Java Team

SHARE THIS STORY

Community creations.

Discover the best add-ons, mods, and more being built by the incredible Minecraft community!

Block...Block...Block...

COMMENTS

  1. Java Assignment Operators with Examples

    Learn how to use assignment operators in Java to assign values to variables. See the syntax, types, and examples of simple and compound assignment operators, and how they perform implicit type casting.

  2. Assignment, Arithmetic, and Unary Operators (The Java™ Tutorials

    Learn how to use the simple assignment operator " = " and the arithmetic operators +, -, *, /, and % in Java. Also, see how to apply the unary operators +, -, ++, --, and ! to perform various operations on values and expressions.

  3. Java Operators

    Learn how to use operators to perform operations on variables and values in Java. Find out the syntax and examples of arithmetic, assignment, comparison, logical and bitwise operators.

  4. Types of Assignment Operators in Java

    To assign a value to a variable, use the basic assignment operator (=). It is the most fundamental assignment operator in Java. It assigns the value on the right side of the operator to the variable on the left side. Example: int x = 10; int x = 10; In the above example, the variable x is assigned the value 10.

  5. Java Operators: Arithmetic, Relational, Logical and more

    Learn about the different types of operators in Java, such as arithmetic, assignment, relational, logical, unary and bitwise. See examples of how to use them in various expressions and statements.

  6. Java Assignment Operators

    Learn how to use assignment operators in Java to assign values to variables using different operators. See the syntax, types, and examples of simple and compound assignment operators in Java.

  7. Operators (The Java™ Tutorials > Learning the Java Language

    Learn how to use operators to perform operations on variables and expressions in Java. See the precedence and usage of different types of operators, including assignment operators.

  8. Java Assignment Operators

    Learn how to use the assignment operator = and the chain assignment operator = = in Java. See syntax, examples and output of assigning values to variables.

  9. Java Operators

    Learn about different types of operators in Java, such as arithmetic, unary, relational, logical, and ternary. See examples of how to use them and their functionalities.

  10. Java Assignment operators

    The Java Assignment operators are used to assign the values to the declared variables. The equals ( = ) operator is the most commonly used Java assignment operator. For example: int i = 25; The table below displays all the assignment operators in the Java programming language. Operators.

  11. All Java Assignment Operators (Explained With Examples)

    All Java assignment operators have right-to-left associativity, which means that the value given on the operator's right-hand side is assigned to the variable given on the left side. So, the value on the right side must be declared before we use it, or it should be a constant.

  12. Java Assignment Operators

    Java allows you to combine assignment and addition operators using a shorthand operator. For example, the preceding statement can be written as: i +=8; //This is same as i = i+8; The += is called the addition assignment operator. Other shorthand operators are shown below table. Operator. Name.

  13. Assignment Operators in Java

    Description:Welcome to Lecture 14 of our Java Programming series! In this enlightening tutorial, we're going to explore a crucial component of Java programmi...

  14. operators, expressions, precedence, associativity in Java

    The compound assignment operators are right to left associated. We might expect the result to be 1. But the actual result is 0. Because of the associativity. The expression on the right is evaluated first and then the compound assignment operator is applied. $ java Associativity.java 0 0 0 0 0 Java ternary operator

  15. Do the pre and post operators matter outside of assignments?

    For one of the operators the result is the value of "i" before incrementing, and for the other the result is the value of "i" after incrementing. No doubt you know which. So yes, the only concern is when you use the result of the operator. You mentioned assignments, which is true, but be careful, it's not only = which causes an assignment.

  16. Summary of Operators (The Java™ Tutorials > Learning the Java Language

    The following quick reference summarizes the operators supported by the Java programming language. Simple Assignment Operator = Simple assignment operator Arithmetic Operators + Additive operator (also used for String concatenation) - Subtraction operator * Multiplication operator / Division operator % Remainder operator ...

  17. Shortcut "or-assignment" (|=) operator in Java

    The |= is a compound assignment operator ( JLS 15.26.2) for the boolean logical operator | ( JLS 15.22.2 ); not to be confused with the conditional-or || ( JLS 15.24 ). There are also &= and ^= corresponding to the compound assignment version of the boolean logical & and ^ respectively. In other words, for boolean b1, b2, these two are equivalent:

  18. Java Bitwise AND Assignment (&=) Operator

    In Java, Bitwise AND Assignment Operator is used to compute the Bitwise AND operation of left and right operands, and assign the result back to left operand. In this tutorial, we will learn how to use Bitwise AND Assignment operator in Java, with examples. The syntax to compute bitwise AND a value of 2 and value in variable x, and assign the ...

  19. What is += Addition Assignment Operator in Java?

    It's the Addition assignment operator. Let's understand the += operator in Java and learn to use it for our day to day programming. x += y in Java is the same as x = x + y. It is a compound assignment operator. Most commonly used for incrementing the value of a variable since x++ only increments the value by one.

  20. Compound Assignment Operator in Java

    Compound Assignment Operator in Java. In Java, assignment operator is used to assign values to a variable. In this section, we will discuss the compound assignment operators in Java.. Compound Assignment Operator. The compound assignment operator is the combination of more than one operator. It includes an assignment operator and arithmetic operator or bitwise operator.

  21. Java Operators : |= bitwise OR and assign example

    a |= b; is the same as. a = (a | b); It calculates the bitwise OR of the two operands, and assigns the result to the left operand. To explain your example code: for (String search : textSearch.getValue()) matches |= field.contains(search); I presume matches is a boolean; this means that the bitwise operators behave the same as logical operators.

  22. Minecraft Java Edition 1.20.5

    The included Java distribution is now the Microsoft build of OpenJDK 21.0.3 ... Allowed server operators to view dedicated server TPS debug chart; Added JFR (Java Flight ... has been removed, and replaced with custom_data assignment. e.g. /give @s stick{foo:'bar'} becomes /give @s stick[custom_data={foo:'bar'}] Modifier operations in the ...